Use CreateMultipartUpload with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use CreateMultipartUpload with an AWS SDK or CLI

The following code examples show how to use CreateMultipartUpload.

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 examples:

CLI
AWS CLI

The following command creates a multipart upload in the bucket my-bucket with the key multipart/01:

<userinput>aws s3api create-multipart-upload --bucket <replaceable>my-bucket</replaceable> --key '<replaceable>multipart/01</replaceable>'</userinput>

Output:

{ "Bucket": "my-bucket", "UploadId": "dfRtDYU0WWCCcH43C3WFbkRONycyCpTJJvxu2i5GYkZljF.Yxwh6XG7WfS2vC4to6HiV6Yjlx.cph0gtNBtJ8P3URCSbB7rjxI5iEwVDmgaXZOGgkk5nVTW16HOQ5l0R", "Key": "multipart/01" }

The completed file will be named 01 in a folder called multipart in the bucket my-bucket. Save the upload ID, key and bucket name for use with the upload-part command.

Rust
SDK for Rust
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

let multipart_upload_res: CreateMultipartUploadOutput = client .create_multipart_upload() .bucket(&bucket_name) .key(&key) .send() .await .unwrap();