Created
September 1, 2021 13:54
-
-
Save faermanj/7f9dc0ce9ae9cfe7cbddcbea643d41d3 to your computer and use it in GitHub Desktop.
Delete a versioned bucket
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
aws s3api put-bucket-versioning --bucket "{{bucket}}" --versioning-configuration "Status=Suspended"; | |
aws s3api delete-objects --bucket "{{bucket}}" --delete "$(aws s3api list-object-versions --bucket "{{bucket}}" --output=json --query='{Objects: *[].{Key:Key,VersionId:VersionId}}')"; | |
aws s3api delete-bucket-policy --bucket "{{bucket}}"; | |
aws s3 rm "s3://{{bucket}}" --recursive; | |
aws s3 rb "s3://{{bucket}}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment