Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use AbortMultipartUpload
with an Amazon SDK or CLI
The following code examples show how to use AbortMultipartUpload
.
Action examples are code excerpts from larger programs and must be run in context. You can see this action in
context in the following code example:
- CLI
-
- Amazon CLI
-
To abort the specified multipart upload
The following abort-multipart-upload
command aborts a multipart upload for the key multipart/01
in the bucket my-bucket
.
aws s3api abort-multipart-upload \
--bucket my-bucket \
--key multipart/01 \
--upload-id dfRtDYU0WWCCcH43C3WFbkRONycyCpTJJvxu2i5GYkZljF.Yxwh6XG7WfS2vC4to6HiV6Yjlx.cph0gtNBtJ8P3URCSbB7rjxI5iEwVDmgaXZOGgkk5nVTW16HOQ5l0R
The upload ID required by this command is output by create-multipart-upload
and can also be retrieved with list-multipart-uploads
.
- PowerShell
-
- Tools for PowerShell
-
Example 1: This command aborts multipart uploads created earlier than 5 days ago.
Remove-S3MultipartUpload -BucketName test-files -DaysBefore 5
Example 2: This command aborts multipart uploads created earlier than January 2nd, 2014.
Remove-S3MultipartUpload -BucketName test-files -InitiatedDate "Thursday, January 02, 2014"
Example 3: This command aborts multipart uploads created earlier than January 2nd, 2014, 10:45:37.
Remove-S3MultipartUpload -BucketName test-files -InitiatedDate "2014/01/02 10:45:37"
For a complete list of Amazon SDK developer guides and code examples, see
Using this service with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.