Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Abort all orphaned multipart upload fragments for a bucket.
# Usage
# ./ [profile]
# Requirements
# jq
# awscli
aws s3 ls --profile $profile | \
cut -f 3 -d ' ' | \
while read bucket; do
echo "Listing upload fragments in $bucket"
aws s3api list-multipart-uploads --profile $profile --bucket $bucket | \
jq -r '.Uploads[] | "--key \"\(.Key)\" --upload-id \(.UploadId)"' | while read -r line; do
echo " abort-multipart-upload $line"
eval "aws s3api abort-multipart-upload --profile $profile --bucket $bucket $line"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.