Created
March 20, 2018 13:11
-
-
Save oussemos/03970c94bc4b75f1088f8e4a0af93dac to your computer and use it in GitHub Desktop.
Delete bucket S3 all version with boto3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
wired_buckets = [ | |
'bucket', | |
] | |
s3 = boto3.resource('s3') | |
for wired_bucket in wired_buckets: | |
print wired_bucket | |
bucket = s3.Bucket(wired_bucket) | |
try: | |
bucket.object_versions.delete() | |
except: | |
print 'bucket does not exist' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment