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.
When uploading a part, you specify a key which can then be used to identify the part. For more information, see Listing Parts in 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. For more information, see Completing a Multipart Upload or Canceling a Multipart Upload.
Uploading a Part Using AWS CLI
Before you begin:
|
To upload a part, use the upload-part command following this syntax:
$ aws s3api upload-part \
--profile YOUR_PROFILE \
--bucket BUCKET \
--key MULTIPART_UPLOAD \
--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 in which you created the multipart upload. -
key
: The name given to the multipart upload you want to upload a part to. -
body
: The path on your machine to the part you want to upload. -
part-number
: The part number of the part you want to upload. The number must be a positive integer between1
and10000
. -
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 of1048567
(1 MiB), and the maximum is4294967296
(4 GiB). -
endpoint
: The endpoint corresponding to the Region you want to send the request to. For more information, see Installing and Configuring AWS CLI.
The upload-part command returns the following element:
-
ETag
: The ETag of the part.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.
{
"ETag": "\"44c7af3f06fd63a36593826be3cb7684\""
}
The part you uploaded does not immediately appear in the bucket because the multipart upload process is not yet complete. Indeed, the parts you upload are only re-assembled and visible in the bucket as a single object once you explicitly complete the multipart upload. For more information, see Completing a Multipart Upload. |
Related Pages
AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.