Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
Minio is an object storage server that is compatible with Amazon S3. You can run your own object storage server using docker:
- https://docs.minio.io/docs/minio-docker-quickstart-guide

And you can use its Python SDK in order to talk to its endpoint API:
- https://github.com/minio/minio-py

It's usage is very simple and elegant. If you are unfamiliar with object storage read more here:
- https://en.wikipedia.org/wiki/Object_storage

#minio #python #sdk #docker #object_storage
How to upload file into Amazon object storage using boto3?

pip install boto3


Now you just need the region, endpoint and access key, secret key which you would be given after purchase:

client = session.client('s3',
region_name=YOUR_REGION,
endpoint_url=YOUR_HOST,
aws_access_key_id=YOUR_ACCESS_KEY,
aws_secret_access_key=YOUR_SECRET_KEY)

client.upload_file(file_path, # Path to local file
obj_config['spacename'], # Name of Space
'YOUR_FILE_NAME.txt', # Name for remote file
ExtraArgs={"Metadata": {'user-id': USER_ID} }) # metadata

NOTE: in the name of the file you can pass / like my/file/here.txt. Now it will create directory (virtually) in the remote object storage.

#python #object_storage #boto3 #file_upload