Menu
Amazon Simple Storage Service
API Reference (API Version 2006-03-01)

Initiate Multipart Upload

Description

This operation initiates a multipart upload and returns an upload ID. This upload ID is used to associate all of the parts in the specific multipart upload. You specify this upload ID in each of your subsequent upload part requests (see Upload Part). You also include this upload ID in the final request to either complete or abort the multipart upload request.

For more information about multipart uploads, see Multipart Upload Overview in the Amazon Simple Storage Service Developer Guide.

If you have configured a lifecycle rule to abort incomplete multipart uploads, the upload must complete within the number of days specified in the bucket lifecycle configuration. Otherwise, the incomplete multipart upload becomes eligible for an abort operation and Amazon S3 aborts the multipart upload. For more information, see Aborting Incomplete Multipart Uploads Using a Bucket Lifecycle Policy in the Amazon Simple Storage Service Developer Guide.

For information about the permissions required to use the multipart upload API, see Multipart Upload API and Permissions in the Amazon Simple Storage Service Developer Guide.

For request signing, multipart upload is just a series of regular requests. You initiate a multipart upload, send one or more requests to upload parts, and then complete the multipart upload process. You sign each request individually. There is nothing special about signing multipart upload requests. For more information about signing, see Authenticating Requests (AWS Signature Version 4).

Note

After you initiate a multipart upload and upload one or more parts, to stop being charged for storing the uploaded parts, you must either complete or abort the multipart upload. Amazon S3 frees up the space used to store the parts and stop charging you for storing them only after you either complete or abort a multipart upload.

You can optionally request server-side encryption. For server-side encryption, Amazon S3 encrypts your data as it writes it to disks in its data centers and decrypts it when you access it. You can provide your own encryption key, or use AWS Key Management Service (AWS KMS) encryption keys or Amazon S3-managed encryption keys. If you choose to provide your own encryption key, the request headers you provide in Upload Part and Upload Part - Copy requests must match the headers you used in the request to initiate the upload by using Initiate Multipart Upload. For more information, see Protecting Data Using Server-Side Encryption in the Amazon Simple Storage Service Developer Guide.

Requests

Syntax

POST /ObjectName?uploads HTTP/1.1 Host: BucketName.s3.amazonaws.com Date: date Authorization: authorization string (see Authenticating Requests (AWS Signature Version 4))

Request Parameters

This operation does not use request parameters.

Request Headers

Name Description Required
Cache-Control

Can be used to specify caching behavior along the request/reply chain. For more information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.

Type: String

Default: None

No
Content-​Disposition

Specifies presentational information for the object. For more information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1.

Type: String

Default: None

No
Content-Encoding

Specifies the content encodings that have been applied to the object and which decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. For more information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11.

Type: String

Default: None

No
Content-Type

A standard MIME type that describes the format of the object data. For more information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17.

Type: String

Default: binary/octet-stream

Constraints: MIME types only

No
Expires

The date and time at which the object should no longer be cached. For more information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21.

Type: String

Default: None

No
x-amz-meta-

Headers starting with this prefix are user-defined metadata. Each one is stored and returned as a set of key-value pairs. Amazon S3 doesn't validate or interpret user-defined metadata. For more information, see PUT Object.

Type: String

Default: None

No
x-amz-storage-​class

The type of storage to use for the object that is created after a successful multipart upload. If you don't specify a class, Amazon S3 uses the default storage class, Standard. Amazon S3 supports other storage classes. For more information, see Storage Classes in the Amazon Simple Storage Service Developer Guide.

Type: Enum

Default: STANDARD

Valid Values: STANDARD | STANDARD_IA | ONEZONE_IA | REDUCED_REDUNDANCY

Constraints: You cannot specify GLACIER as the storage class. To transition objects to the GLACIER storage class, use lifecycle configuration. For more information, see Object Lifecycle Management in the Amazon Simple Storage Service Developer Guide.

No
x-amz-tagging

Specifies a set of one or more tags you want associated with the object. These tags are stored in the tagging subresource associated with the object.

For more information about adding tags to an object, see Object Tagging Management in the Amazon Simple Storage Service Developer Guide.

Type: String

Default: None

Constraints: The encoding for tags will be URL query parameter encoding. The maximum size of this header is limited to 2 K.

No
x-amz-website​-redirect-location

If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata. For information about object metadata, see Object Key and Metadata.

In the following example, the request header sets the redirect to an object (anotherPage.html) in the same bucket:

x-amz-website-redirect-location: /anotherPage.html

In the following example, the request header sets the object redirect to another website:

x-amz-website-redirect-location: http://www.example.com/

For more information about website hosting in Amazon S3, see Hosting Websites on Amazon S3 and How to Configure Website Page Redirects in the Amazon Simple Storage Service Developer Guide.

Type: String

Default: None

Constraints: The value must be prefixed by, "/", "http://" or "https://". The length of the value is limited to 2 K.

No

Access Control List (ACL) Specific Request Headers

Additionally, you can use the following access control-related headers with this operation. By default, all objects are private and only the owner has full access control. When adding a new object, you can grant permissions to individual AWS accounts or predefined groups defined by Amazon S3. These permissions are then added to the Access Control List (ACL) on the object. For more information, see Access Control List (ACL) Overview in the Amazon Simple Storage Service Developer Guide. This operation enables you to grant access permissions using one of the following methods:

  • Specify canned ACL – Amazon S3 supports a set of predefined ACLs, known as canned ACLs. Each canned ACL has a predefined set of grantees and permissions. For more information, see Canned ACL.

    Name Description Required
    x-amz-acl

    The canned ACL to apply to the object.

    Type: String

    Default: private

    Valid Values: private | public-read | public-read-write | aws-exec-read | authenticated-read | bucket-owner-read | bucket-owner-full-control

    Constraints: None

    No
  • Specify access permissions explicitly – If you want to explicitly grant access permissions to specific AWS accounts or groups, use the following headers. Each of these headers maps to specific permissions that Amazon S3 supports in an access control list (ACL). For more information, see Access Control List (ACL) Overview. In the header, you specify a list of grantees who get the specific permission.

    Name Description Required
    x-amz-grant-read

    Allows the grantee to read the object data and its metadata.

    Type: String

    Default: None

    Constraints: None

    No
    x-amz-grant-write

    Not applicable.

    Type: String

    Default: None

    Constraints: None

    No
    x-amz-grant-read-acp

    Allows the grantee to read the object ACL.

    Type: String

    Default: None

    Constraints: None

    No
    x-amz-grant-write-acp

    Allows the grantee to write the ACL for the applicable object.

    Type: String

    Default: None

    Constraints: None

    No
    x-amz-grant-full-control

    Grants the grantee the READ, READ_ACP, and WRITE_ACP permissions on the object.

    Type: String

    Default: None

    Constraints: None

    No

You specify each grantee as a type=value pair, where the type can be one of the following:

  • emailAddress – If the specified value is the email address of an AWS account.

  • id – If the specified value is the canonical user ID of an AWS account.

  • uri – If you are granting permission to a predefined group.

For example, the following x-amz-grant-read header grants read object data and its metadata permissions to the AWS accounts identified by their email addresses:

x-amz-grant-read: emailAddress="xyz@amazon.com", emailAddress="abc@amazon.com"

Server-Side Encryption–Specific Request Headers

You can optionally tell Amazon S3 to encrypt data at rest using server-side encryption. Server-side encryption is for data encryption at rest. Amazon S3 encrypts your data as it writes it to disks in its data centers and decrypts it when you access it. Depending on whether you want to use AWS-managed encryption keys or provide your own encryption keys, you use the following headers:

  • Use encryption keys managed by AWS KMS or Amazon S3 – If you want AWS to manage the keys used to encrypt data, specify the following headers in the request.

    Name Description Required
    x-amz-server-side​-encryption

    Specifies a server-side encryption algorithm to use when Amazon S3 creates an object.

    Type: String

    Valid Value: aws:kms, AES256

    Yes
    x-amz-server-side-encryption-aws-kms-key-id

    If the x-amz-server-side-encryption is present and has the value of aws:kms, this header specifies the ID of the AWS Key Management Service (AWS KMS) master encryption key that was used for the object.

    Type: String

    Yes, if the value of x-amz-server-side-encryption is aws:kms
    x-amz-server-side-encryption-context

    If x-amz-server-side-encryption is present, and if its value is aws:kms, this header specifies the encryption context for the object. The value of this header is a base64-encoded UTF-8 string holding JSON with the encryption context key-value pairs.

    Type: String

    No

    Note

    If you specify x-amz-server-side-encryption:aws:kms, but do not provide x-amz-server-side- encryption-aws-kms-key-id, Amazon S3 uses the default AWS KMS key to protect the data.

    For more information on Server-Side Encryption with Amazon KMS-Managed Keys (SSE-KMS), see Protecting Data Using Server-Side Encryption with AWS KMS-Managed Keys in the Amazon Simple Storage Service Developer Guide.

  • Use customer-provided encryption keys – If you want to manage your own encryption keys, provide all the following headers in the request.

    Name Description Required
    x-amz-server-side​-encryption​-customer-algorithm

    Specifies the algorithm to use to when encrypting the object.

    Type: String

    Default: None

    Valid Value: AES256

    Constraints: Must be accompanied by valid x-amz-server-side-encryption-customer-key and x-amz-server-side-encryption-customer-key-MD5 headers

    Yes
    x-amz-server-side​-encryption​-customer-key

    Specifies the customer-provided base64-encoded encryption key that Amazon S3 uses in encrypting data. This value stores the object and then is discarded. Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header.

    Type: String

    Default: None

    Constraints: Must be accompanied by valid x-amz-server-side-encryption-customer-algorithm and x-amz-server-side-encryption-customer-key-MD5 headers

    Yes
    x-amz-server-side​-encryption​-customer-key-MD5

    Specifies the base64-encoded 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure that the encryption key was transmitted without error.

    Type: String

    Default: None

    Constraints: Must be accompanied by valid x-amz-server-side-encryption-customer-algorithm and x-amz-server-side-encryption-customer-key headers

    Yes

    For more information on Server-Side Encryption with Customer-Provided Encryption Keys (SSE-C), see Protecting Data Using Server-Side Encryption with Customer-Provided Encryption Keys (SSE-C) in the Amazon Simple Storage Service Developer Guide.

Request Elements

This operation does not use request elements.

Responses

Response Headers

This implementation of the operation can include the following response headers in addition to the response headers common to all responses. For more information, see Common Response Headers.

Name Description
x-amz-abort-date

If the bucket has a lifecycle rule configured with an action to abort incomplete multipart uploads and the prefix in the lifecycle rule matches the object name in the request, the response includes this header. The header indicates when the initiated multipart upload becomes eligible for an abort operation. For more information, see Aborting Incomplete Multipart Uploads Using a Bucket Lifecycle Policy in the Amazon Simple Storage Service Developer Guide.

The response also includes the x-amz-abort-rule-id header that provides the ID of the lifecycle configuration rule that defines this action.

Type: String

x-amz-abort​-rule-id

This header is returned along with the x-amz-abort-date header. It identifies the applicable lifecycle configuration rule that defines the action to abort incomplete multipart uploads.

Type: String

x-amz-server-side​-encryption

If you specified server-side encryption either with an AWS KMS key or an Amazon S3-managed encryption key in your initiate multipart upload request, the response includes this header. It confirms the encryption algorithm that Amazon S3 used to encrypt the part that you uploaded.

Type: String

x-amz-server-side-encryption-aws-kms-key-id

If x-amz-server-side-encryption is present and has the value of aws:kms, this header specifies the ID of the AWS KMS master encryption key that was used for the object.

Type: String

x-amz-server-side​-encryption​-customer-algorithm

If server-side encryption with customer-provided encryption keys was requested, the response includes this header to confirm which encryption algorithm was used.

Type: String

Valid Values: AES256

x-amz-server-side​-encryption​-customer-key-MD5

If server-side encryption using a customer-provided encryption key was requested, the response returns this header to verify the integrity of the roundtrip message of the customer-provided encryption key.

Type: String

Response Elements

Name Description
InitiateMultipartUploadResult

Container for the response.

Type: Container

Children: Bucket, Key, UploadId

Ancestors: None

Bucket

Name of the bucket to which the multipart upload was initiated.

Type: String

Ancestors: InitiateMultipartUploadResult

Key

Object key for which the multipart upload was initiated.

Type: String

Ancestors: InitiateMultipartUploadResult

UploadId

ID for the initiated multipart upload.

Type: String

Ancestors: InitiateMultipartUploadResult

Special Errors

This implementation of the operation does not return special errors. For general information about Amazon S3 errors and a list of error codes, see Error Responses.

Examples

Sample Request

This operation initiates a multipart upload for the example-object object.

POST /example-object?uploads HTTP/1.1 Host: example-bucket.s3.amazonaws.com Date: Mon, 1 Nov 2010 20:34:56 GMT Authorization: authorization string

Sample Response

HTTP/1.1 200 OK x-amz-id-2: Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg== x-amz-request-id: 656c76696e6727732072657175657374 Date: Mon, 1 Nov 2010 20:34:56 GMT Content-Length: 197 Connection: keep-alive Server: AmazonS3 <?xml version="1.0" encoding="UTF-8"?> <InitiateMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Bucket>example-bucket</Bucket> <Key>example-object</Key> <UploadId>VXBsb2FkIElEIGZvciA2aWWpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZA</UploadId> </InitiateMultipartUploadResult>

Sample: Initiate a Multipart Upload Using Server-side Encryption with Customer-provided Encryption Keys

This example, which initiates a multipart upload request, specifies server-side encryption with customer-provided encryption keys by adding relevant headers.

POST /example-object?uploads HTTP/1.1 Host: example-bucket.s3.amazonaws.com Authorization:authorization string Date: Wed, 28 May 2014 19:34:57 +0000 x-amz-server-side-encryption-customer-key: g0lCfA3Dv40jZz5SQJ1ZukLRFqtI5WorC/8SEEXAMPLE x-amz-server-side-encryption-customer-key-MD5: ZjQrne1X/iTcskbY2example x-amz-server-side-encryption-customer-algorithm: AES256  

In the response, Amazon S3 returns an UploadId. In addition, Amazon S3 returns the encryption algorithm and the MD5 digest of the encryption key that you provided in the request.

HTTP/1.1 200 OK x-amz-id-2: 36HRCaIGp57F1FvWvVRrvd3hNn9WoBGfEaCVHTCt8QWf00qxdHazQUgfoXAbhFWD x-amz-request-id: 50FA1D691B62CA43 Date: Wed, 28 May 2014 19:34:58 GMT x-amz-server-side-encryption-customer-algorithm: AES256 x-amz-server-side-encryption-customer-key-MD5: ZjQrne1X/iTcskbY2m3tFg== Transfer-Encoding: chunked <?xml version="1.0" encoding="UTF-8"?> <InitiateMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Bucket>example-bucket</Bucket> <Key>example-object</Key> <UploadId>EXAMPLEJZ6e0YupT2h66iePQCc9IEbYbDUy4RTpMeoSMLPRp8Z5o1u8feSRonpvnWsKKG35tI2LB9VDPiCgTy.Gq2VxQLYjrue4Nq.NBdqI-</UploadId> </InitiateMultipartUploadResult>