Created
January 10, 2024 23:56
-
-
Save lordjabez/a1c15ef5cdcc03d2b55a4709df572502 to your computer and use it in GitHub Desktop.
Delete all partial multipart uploads in an S3 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
#!/usr/bin/env bash | |
set -e | |
BUCKETNAME=$1 | |
aws s3api list-multipart-uploads --bucket $BUCKETNAME \ | |
| jq -r '.Uploads[] | "--key \"\(.Key)\" --upload-id \(.UploadId)"' \ | |
| while read -r line; do | |
eval "aws s3api abort-multipart-upload --bucket $BUCKETNAME $line"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment