Configuring AWS S3 Lifecycle to Abort and Delete Parts Generated by Multipart Upload
What is Multipart Upload parts, please refer: What is AWS S3 GlacierStagingStorage Cost
This is what I want to eliminate:
Since the uncompleted parts cannot be seen from console, let’s check it out from CLI. A snippet of how it looks like.
aws s3api list-multipart-uploads --bucket YourBucketName
I want to know total uncompleted files.
aws s3api list-multipart-uploads --bucket YourBucketName | grep “OWNER” | wc -l
It is confirmed that uncompleted multi uploaded parts exist, lets configure a bucket lifecycle to abort the upload and delete associated parts. Start by clicking on the bucket then Management.
Add a lifecycle rule, give your rule a name then click next.
We are not doing Storage class transition so click next.
Configure as the image below to abort the multipart uploads and set your desire days. Make sure to set days longer then the actual days needed to upload the file, otherwise your upload will be aborted and deleted while still uploading. Click Next to the review page.
Review the settings and click save.
Finished view of the bucket lifecycle configuration, and that’s it! Your uncompleted parts generated by multipart upload will be deleted according to the days you configured in the step.