Uploading a Part

You can upload several parts of a large object in a multipart upload.

You can upload a part to one of the multipart uploads you created or to a multipart upload created by another user. To do so, you need to have the appropriate permissions for both the bucket and the multipart upload.

It is recommended to use the multipart upload for objects that are larger than 100 MiB. You can upload from 1 to 10000 parts whose sizes are between 1 MiB and 4 GiB in a multipart upload to complete an object.

When uploading a part, you specify a key that creates a sub-part in a multipart upload. You can create several sub-parts in a multipart upload. All the parts you upload with the same key are gathered in the same sub-part. This sub-part has the same behavior as a multipart upload, you can list it, complete it or abort it. For more information, see Listing Parts in a Multipart Upload, Completing a Multipart Upload and Canceling a Multipart Upload.

The parts you upload must all have the same size except for the last part that must be equal or smaller than the other parts.

When all the parts are uploaded, you need to specify if you want to complete the multipart upload to reconstitute the object within your bucket, or to cancel the multipart upload and remove all the parts you uploaded in your bucket.

This feature is not available from Cockpit. This documentation only describes the procedure using AWS CLI.

Before you begin: To upload a part, you first need to create a multipart upload. For more information, see Creating a Multipart Upload.

To upload a part, use the upload-part command following this syntax:

Request Sample
$ aws s3api upload-part \
    --profile YOUR_PROFILE \
    --bucket BUCKET \
    --key SUB_PART \
    --body usr/bin/YOUR_OBJECT \
    --part-number 1 \
    --upload-id 2~xrosnH8pbKTk3sjXijfGIUN1KAEM3Yc \
    --content-length 1048567 \
    --endpoint https://oos.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • bucket: The bucket that contains the object you want to upload in multipart.

  • key: The name you want for your sub-part.

  • body: The path to the object on your machine.

  • part-number: The part number of the part you upload. The number must be a positive integer between 1 and 10000.

  • upload-id: The ID of the upload you received when creating a multipart upload. For more information, see Creating a Multipart Upload.

  • (optional) content-length: If the size cannot be defined automatically, the size of the body, in bytes. The minimum must be of 1048567 (1 MiB), and the maximum is 4294967296 (4 GiB).

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The upload-part command returns the following element:

  • ETag: The ETag of the upload.

    Save this element carefully, as you will need it for further commands of multipart upload.

    In case of loss of this element, you can retrieve it. For more information, see Listing the Multipart Uploads of a Bucket.

Result Sample
{
    "ETag": "\"44c7af3f06fd63a36593826be3cb7684\""
}

Related Pages

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.