how to delete files from amazon s3 bucket?
Using boto3
(currently version 1.4.4) use S3.Object.delete()
.
import boto3s3 = boto3.resource('s3')s3.Object('your-bucket', 'your-key').delete()
Using the Python boto3 SDK (and assuming credentials are setup for AWS), the following will delete a specified object in a bucket:
import boto3client = boto3.client('s3')client.delete_object(Bucket='mybucketname', Key='myfile.whatever')