How to upload file into
Now you just need the region, endpoint and access key, secret key which you would be given after purchase:
#python #object_storage #boto3 #file_upload
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