Sometimes multipart uploads hang or don\'t complete for some reason. In that case you are stuck with orphaned parts that are tricky to remove. You can list them with:
Assuming you have your awscli
all setup and it'll output JSON you can use jq
to project the needed keys with:
BUCKETNAME=
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