Last active
September 10, 2022 11:54
-
-
Save yue4u/bda7b7c5e7352dc8e33862abc308019a to your computer and use it in GitHub Desktop.
I tried and searched a lot but still failed to delete a s3 bucket, here is the finial answer.
This file contains 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
#!/usr/bin/env python3 | |
import boto3 | |
bucket_name = '' | |
bucket = s3.Bucket(bucket_name) | |
s3 = boto3.resource('s3') | |
print('deleting ....') | |
bucket.object_versions.all().delete() | |
bucket.delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment