Skip to content

Instantly share code, notes, and snippets.

@lordjabez
Created January 10, 2024 23:56
Show Gist options
  • Save lordjabez/a1c15ef5cdcc03d2b55a4709df572502 to your computer and use it in GitHub Desktop.
Save lordjabez/a1c15ef5cdcc03d2b55a4709df572502 to your computer and use it in GitHub Desktop.
Delete all partial multipart uploads in an S3 bucket
#!/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