Cloudian is fully compatible with S3, so it's convenient to use the AWS SDK! Last time tried to display a list of objects in Python (boto3).
This time, I will try to delete the object stored in the bucket of the object storage with Python (boto3).
Use delete_object () to delete the file (object) uploaded to Cloudian.
In the following example, the latest version of the object of the key "10mb.dat" stored in the bucket "pythonbucket1" is deleted.
test.py
import boto3
client = boto3.client(
's3',
endpoint_url='https://xxx.yyy.com'
)
#Bucket name:pythonbucket1 object:10mb.Delete dat file
client.delete_object(Bucket='pythonbucket1', Key='10mb.dat')
{'ResponseMetadata': {'RequestId': '9dad3b68-0e30-1dbc-a754-06bdfcde1d5e',
'HostId': '',
'HTTPStatusCode': 204,
'HTTPHeaders': {'date': 'Sun, 13 Dec 2020 22:27:45 GMT',
'x-amz-request-id': '9dad3b68-0e30-1dbc-a754-06bdfcde1d5e',
'server': 'CloudianS3'},
'RetryAttempts': 0}}
I tried deleting the object in Python (boto3).
Next time, I would like to operate object storage/Cloudian in various ways with Python.
Recommended Posts