Currently this is a limitation in S3 but you can use external programs using python with boto or boto3 or java to delete through the versions and then delete the bucket.
else
use console to delete the versions and then delete the bucket.
Below I am boto to delete the versions and then the empty bucket.
shaiks@shaikslinux>aws s3 ls s3://
2017-10-11 15:56:55 shaiks3333
2017-10-05 18:55:57 shaiks3334
2017-10-06 03:55:40 thecloudgenie.com
2017-10-05 18:58:51 www.thecloudgenie.com
Here is error message:
shaiks@shaikslinux>aws s3 rb s3://shaiks3333/
remove_bucket failed: s3://shaiks3333/ An error occurred (BucketNotEmpty) when calling the DeleteBucket operation: The bucket you tried to delete is not empty. You must delete all versions in the bucket.
Using boto to delete the versions:
shaiks@shaikslinux>python remove_bucket3.py
shaiks@shaikslinux>cat remove_bucket3.py
import boto3
BUCKET = 'shaiks3333'
s3 = boto3.resource('s3')
bucket = s3.Bucket(BUCKET)
bucket.object_versions.delete()
# if you want to delete the now-empty bucket
bucket.delete()
shaiks@shaikslinux>aws s3 ls s3://
2017-10-05 18:55:57 shaiks3334
2017-10-06 03:55:40 thecloudgenie.com
2017-10-05 18:58:51 www.thecloudgenie.com
Bucket shaiks3333 is now deleted from s3:
No comments:
Post a Comment