← All posts
2 min read

Abort an incomplete S3 multipart upload

#aws#cli#s3#storage
📑 On this page

Part 47 of AWS from Zero. This lesson keeps the scope to one S3 behavior you can verify from the terminal.

What we are learning

Incomplete multipart uploads are invisible to normal object listing but their uploaded parts consume storage.

Before you run it

aws sts get-caller-identity
REGION="ap-south-1"
BUCKET="replace-with-your-private-demo-bucket"

Use a private general purpose bucket that you own. Replace every placeholder before running a write or delete command.

The command

aws s3api abort-multipart-upload \
  --bucket "$BUCKET" \
  --key large-demo.bin \
  --upload-id "$UPLOAD_ID"

A successful configuration command may return no output. Treat inspection as a separate required step.

Inspect the result

aws s3api list-multipart-uploads \
  --bucket "$BUCKET" \
  --query "Uploads[].{Key:Key,UploadId:UploadId}" \
  --output table

Read the returned fields rather than assuming the write succeeded exactly as intended.

One tiny variation

aws s3api list-parts \
  --bucket "$BUCKET" \
  --key large-demo.bin \
  --upload-id "$UPLOAD_ID"

After a successful abort, listing parts for that upload ID should return NoSuchUpload.

Common mistake

Aborting one upload ID does not abort other unfinished uploads for the same key. List uploads and clean each intended ID.

Cleanup

aws s3api list-multipart-uploads --bucket "$BUCKET"

Confirm the target upload is absent. A lifecycle rule can automate stale-upload cleanup.

Next, we will learn Expire old S3 objects with a lifecycle rule.

Official AWS CLI reference