Last active
August 27, 2015 11:02
-
-
Save peterkuiper/898364f4180bae8309d0 to your computer and use it in GitHub Desktop.
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
# Delete all object versions from a bucket: | |
aws --output text s3api list-object-versions --bucket <your bucket> | grep -E "^VERSIONS" | awk '{print "aws s3api delete-object --bucket <your bucket> --key "$4" --version-id "$8";"}' | |
# Delete all deletion markers from a bucket: | |
aws --output text s3api list-object-versions --bucket <your bucket> | grep -E "^DELETEMARKERS" | awk '{print "aws s3api delete-object --bucket <your bucket> --key "$3" --version-id "$5";"}' | |
# Bucket size | |
aws s3api list-objects --bucket sc-backup-bucket --output json --query "[sum(Contents[].Size), length(Contents[])]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment