Last active
August 27, 2015 11:02
-
-
Save peterkuiper/898364f4180bae8309d0 to your computer and use it in GitHub Desktop.
Revisions
-
Peter Kuiper revised this gist
Aug 27, 2015 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,11 @@ # 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[])]" -
Peter Kuiper created this gist
Aug 26, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ 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";"}'