Complete Multipart Upload
s3_complete_multipart_upload | R Documentation |
Completes a multipart upload by assembling previously uploaded parts¶
Description¶
Completes a multipart upload by assembling previously uploaded parts.
You first initiate the multipart upload and then upload all parts using
the upload_part
operation or the upload_part_copy
operation. After
successfully uploading all relevant parts of an upload, you call this
complete_multipart_upload
operation to complete the upload. Upon
receiving this request, Amazon S3 concatenates all the parts in
ascending order by part number to create a new object. In the
CompleteMultipartUpload request, you must provide the parts list and
ensure that the parts list is complete. The CompleteMultipartUpload API
operation concatenates the parts that you provide in the list. For each
part in the list, you must provide the PartNumber
value and the ETag
value that are returned after that part was uploaded.
The processing of a CompleteMultipartUpload request could take several
minutes to finalize. After Amazon S3 begins processing the request, it
sends an HTTP response header that specifies a 200 OK
response. While
processing is in progress, Amazon S3 periodically sends white space
characters to keep the connection from timing out. A request could fail
after the initial 200 OK
response has been sent. This means that a
200 OK
response can contain either a success or an error. The error
response might be embedded in the 200 OK
response. If you call this
API operation directly, make sure to design your application to parse
the contents of the response and handle it appropriately. If you use
Amazon Web Services SDKs, SDKs handle this condition. The SDKs detect
the embedded error and apply error handling per your configuration
settings (including automatically retrying the request as appropriate).
If the condition persists, the SDKs throw an exception (or, for the SDKs
that don't use exceptions, they return an error).
Note that if complete_multipart_upload
fails, applications should be
prepared to retry any failed requests (including 500 error responses).
For more information, see Amazon S3 Error Best
Practices.
You can't use Content-Type: application/x-www-form-urlencoded
for the
CompleteMultipartUpload requests. Also, if you don't provide a
Content-Type
header, complete_multipart_upload
can still return a
200 OK
response.
For more information about multipart uploads, see Uploading Objects Using Multipart Upload in the Amazon S3 User Guide.
Directory buckets - For directory buckets, you must make requests
for this API operation to the Zonal endpoint. These endpoints support
virtual-hosted-style requests in the format
https://bucket_name.s3express-az_id.region.amazonaws.com/key-name
.
Path-style requests are not supported. For more information, see
Regional and Zonal
endpoints
in the Amazon S3 User Guide.
Permissions¶
-
General purpose bucket permissions - For information about permissions required to use the multipart upload API, see Multipart Upload and Permissions in the Amazon S3 User Guide.
-
Directory bucket permissions - To grant access to this API operation on a directory bucket, we recommend that you use the
create_session
API operation for session-based authorization. Specifically, you grant thes3express:CreateSession
permission to the directory bucket in a bucket policy or an IAM identity-based policy. Then, you make thecreate_session
API call on the bucket to obtain a session token. With the session token in your request header, you can make API requests to this operation. After the session token expires, you make anothercreate_session
API call to generate a new session token for use. Amazon Web Services CLI or SDKs create session and refresh the session token automatically to avoid service interruptions when a session expires. For more information about authorization, seecreate_session
. -
If you provide an additional checksum value in your
MultipartUpload
requests and the object is encrypted with Key Management Service, you must have permission to use thekms:Decrypt
action for thecomplete_multipart_upload
request to succeed.
Special errors¶
-
Error Code:
EntityTooSmall
-
Description: Your proposed upload is smaller than the minimum allowed object size. Each part must be at least 5 MB in size, except the last part.
-
HTTP Status Code: 400 Bad Request
-
-
Error Code:
InvalidPart
-
Description: One or more of the specified parts could not be found. The part might not have been uploaded, or the specified ETag might not have matched the uploaded part's ETag.
-
HTTP Status Code: 400 Bad Request
-
-
Error Code:
InvalidPartOrder
-
Description: The list of parts was not in ascending order. The parts list must be specified in order by part number.
-
HTTP Status Code: 400 Bad Request
-
-
Error Code:
NoSuchUpload
-
Description: The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.
-
HTTP Status Code: 404 Not Found
-
HTTP Host header syntax¶
Directory buckets - The HTTP Host header syntax is
Bucket_name.s3express-az_id.region.amazonaws.com
.
The following operations are related to complete_multipart_upload
:
-
create_multipart_upload
-
upload_part
-
abort_multipart_upload
-
list_parts
-
list_multipart_uploads
Usage¶
s3_complete_multipart_upload(Bucket, Key, MultipartUpload, UploadId,
ChecksumCRC32, ChecksumCRC32C, ChecksumSHA1, ChecksumSHA256,
RequestPayer, ExpectedBucketOwner, IfNoneMatch, SSECustomerAlgorithm,
SSECustomerKey, SSECustomerKeyMD5)
Arguments¶
Bucket
[required] Name of the bucket to which the multipart upload was initiated.
Directory buckets - When you use this operation with a directory bucket, you must use virtual-hosted-style requests in the format
Bucket_name.s3express-az_id.region.amazonaws.com
. Path-style requests are not supported. Directory bucket names must be unique in the chosen Availability Zone. Bucket names must follow the formatbucket_base_name--az-id--x-s3
(for example,DOC-EXAMPLE-BUCKET--usw2-az1--x-s3
). For information about bucket naming restrictions, see Directory bucket naming rules in the Amazon S3 User Guide.Access points - When you use this action with an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
Access points and Object Lambda access points are not supported by directory buckets.
S3 on Outposts - When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
. When you use this action with S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts? in the Amazon S3 User Guide.Key
[required] Object key for which the multipart upload was initiated.
MultipartUpload
The container for the multipart upload request information.
UploadId
[required] ID for the initiated multipart upload.
ChecksumCRC32
This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This header specifies the base64-encoded, 32-bit CRC32 checksum of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
ChecksumCRC32C
This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This header specifies the base64-encoded, 32-bit CRC32C checksum of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
ChecksumSHA1
This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This header specifies the base64-encoded, 160-bit SHA-1 digest of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
ChecksumSHA256
This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This header specifies the base64-encoded, 256-bit SHA-256 digest of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
RequestPayer
ExpectedBucketOwner
The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code
403 Forbidden
(access denied).IfNoneMatch
Uploads the object only if the object key name does not already exist in the bucket specified. Otherwise, Amazon S3 returns a
412 Precondition Failed
error.If a conflicting operation occurs during the upload S3 returns a
409 ConditionalRequestConflict
response. On a 409 failure you should re-initiate the multipart upload withcreate_multipart_upload
and re-upload each part.Expects the '*' (asterisk) character.
For more information about conditional requests, see RFC 7232, or Conditional requests in the Amazon S3 User Guide.
SSECustomerAlgorithm
The server-side encryption (SSE) algorithm used to encrypt the object. This parameter is required only when the object was created using a checksum algorithm or if your bucket policy requires the use of SSE-C. For more information, see Protecting data using SSE-C keys in the Amazon S3 User Guide.
This functionality is not supported for directory buckets.
SSECustomerKey
The server-side encryption (SSE) customer managed key. This parameter is needed only when the object was created using a checksum algorithm. For more information, see Protecting data using SSE-C keys in the Amazon S3 User Guide.
This functionality is not supported for directory buckets.
SSECustomerKeyMD5
The MD5 server-side encryption (SSE) customer managed key. This parameter is needed only when the object was created using a checksum algorithm. For more information, see Protecting data using SSE-C keys in the Amazon S3 User Guide.
This functionality is not supported for directory buckets.
Value¶
A list with the following syntax:
list(
Location = "string",
Bucket = "string",
Key = "string",
Expiration = "string",
ETag = "string",
ChecksumCRC32 = "string",
ChecksumCRC32C = "string",
ChecksumSHA1 = "string",
ChecksumSHA256 = "string",
ServerSideEncryption = "AES256"|"aws:kms"|"aws:kms:dsse",
VersionId = "string",
SSEKMSKeyId = "string",
BucketKeyEnabled = TRUE|FALSE,
RequestCharged = "requester"
)
Request syntax¶
svc$complete_multipart_upload(
Bucket = "string",
Key = "string",
MultipartUpload = list(
Parts = list(
list(
ETag = "string",
ChecksumCRC32 = "string",
ChecksumCRC32C = "string",
ChecksumSHA1 = "string",
ChecksumSHA256 = "string",
PartNumber = 123
)
)
),
UploadId = "string",
ChecksumCRC32 = "string",
ChecksumCRC32C = "string",
ChecksumSHA1 = "string",
ChecksumSHA256 = "string",
RequestPayer = "requester",
ExpectedBucketOwner = "string",
IfNoneMatch = "string",
SSECustomerAlgorithm = "string",
SSECustomerKey = raw,
SSECustomerKeyMD5 = "string"
)
Examples¶
## Not run:
# The following example completes a multipart upload.
svc$complete_multipart_upload(
Bucket = "examplebucket",
Key = "bigobject",
MultipartUpload = list(
Parts = list(
list(
ETag = ""d8c2eafd90c266e19ab9dcacc479f8af"",
PartNumber = "1"
),
list(
ETag = ""d8c2eafd90c266e19ab9dcacc479f8af"",
PartNumber = "2"
)
)
),
UploadId = "7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91..."
)
## End(Not run)