Amazon Simple Storage Service
API Reference (API Version 2006-03-01)
Did this page help you?  Yes | No |  Tell us about it...
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.

Initiate Multipart Upload

Description

This operation initiates a multipart upload and returns an upload ID. This upload ID is used to associate all 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 on multipart uploads, go to Multipart Upload Overview in the Amazon Simple Storage Service Developer Guide.

For information on permissions required to use the multipart upload API, go to 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 multipart upload, send one or more requests to upload parts, and finally complete multipart upload. 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 multipart upload and upload one or more parts, you must either complete or abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage.

You can optionally request server-side encryption where Amazon S3 encrypts your data as it writes it to disks in its data centers and decrypts it for you when you access it. You have the options of providing your own encryption key, using AWS Key Management Service (KMS) encryption keys, or the Amazon S3-managed encryption keys. If you choose to provide your own encryption key, the request headers you provide in the request must match the headers you used in the request to initiate the upload by using Initiate Multipart Upload. For more information, go to 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, go to 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, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1.

Type: String

Default: None

No
Content-Encoding

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

Type: String

Default: None

No
Content-Type

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

Type: String

Default: binary/octel-stream

Constraints: MIME types only

No
Expires

The date and time at which the object is no longer cacheable. For more information, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21.

Type: String

Default: None

No
x-amz-meta-

Any header starting with this prefix is considered user metadata. It will be stored with the object and returned when you retrieve the object.

Type: String

Default: None

No
x-amz-storage-​class

The type of storage to use for the object that is created after successful multipart upload.

Type: String

Valid Values: STANDARD | REDUCED_REDUNDANCY

Default: STANDARD

Constraints: You cannot specify GLACIER as the storage class. To transition objects to the GLACIER storage class you can use lifecycle configuration.

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, go to 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, go to sections 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, 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, go to 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 two ways:

  • 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, go to 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 | 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, you can use the following headers. Each of these headers maps to specific permissions Amazon S3 supports in an ACL. For more information, go to 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 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 grantee to read the object ACL.

    Type: String

    Default: None

    Constraints: None

    No
    x-amz-grant-write-acp

    Allows grantee to write the ACL for the applicable object.

    Type: String

    Default: None

    Constraints: None

    No
    x-amz-grant-full-control

    Allows 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 value specified is the email address of an AWS account.

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

  • uri – if granting permission to a predefined group.

For example, the following x-amz-grant-read header grants read object data and its metadata permission 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 request Amazon S3 to encrypt data at rest using server-side encryption. Server-side encryption is about data encryption at rest, that is, Amazon S3 encrypts your data as it writes it to disks in its data centers and decrypts it for you 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 keys used to encrypt data, you 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 specifices the ID of the AWS Key Management Service (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

    Note

    If you specify x-amz-server-side-encryption:aws:kms, but do not provide x-amz-server-side- encryption-aws-kms-key-id, the default AWS KMS key will be used to protected the data.

    For more information on Server-Side Encryption with Amazon KMS-Managed Keys (SSE-KMS), go to 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, you must 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 for Amazon S3 to use in encrypting data. This value is used to store 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 message integrity check to ensure 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

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-server-side​-encryption

If you specified server-side encryption either with an AWS KMS or 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 you uploaded.

Type: String

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 specifices the ID of the AWS Key Management Service (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 encryption was requested, the response will include this header confirming the encryption algorithm used.

Type: String

Valid Values: AES256

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

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

Type: String

Response Elements

Name Description
InitiateMultipartUploadResult

Container for 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 multipart upload, using server-side encryption with customer-provided encryption keys

This example initiate 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 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>