Created
November 26, 2021 00:42
-
-
Save douglampe/9004098a7bcb7c70f38b9c1ba25f9cdc to your computer and use it in GitHub Desktop.
Delete all versions from an S3 bucket
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
aws s3api delete-objects \ | |
--bucket ${bucket_name} \ | |
--delete "$(aws s3api list-object-versions \ | |
--bucket "${bucket_name}" \ | |
--output=json \ | |
--query='{Objects: Versions[].{Key:Key,VersionId:VersionId}}')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment