howto abort all incomplete multipart uploads for a bucket

前端 未结 5 1575
一个人的身影
一个人的身影 2021-02-07 08:36

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:

         


        
5条回答
  •  粉色の甜心
    2021-02-07 09:25

    Here is my oneliner, that will abort ALL multipart uploads regardless of status, assuming that you don't have any spaces in your key / filename.

    BUCKETNAME=;aws s3api list-multipart-uploads --bucket $BUCKETNAME --query 'Uploads[].[Key, UploadId]' --output text | awk  '{print "aws s3api abort-multipart-upload --upload-id "$2" --bucket $BUCKETNAME --key " $1 " & wait"}{}' | bash
    

提交回复
热议问题