MultipartUpload / Action / complete
complete#
- S3.MultipartUpload.complete(**kwargs)#
Completes a multipart upload by assembling previously uploaded parts.
You first initiate the multipart upload and then upload all parts using the UploadPart operation. After successfully uploading all relevant parts of an upload, you call this action 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 Complete Multipart Upload request, you must provide the parts list. You must ensure that the parts list is complete. This action concatenates the parts that you provide in the list. For each part in the list, you must provide the part number and the
ETagvalue, returned after that part was uploaded.Processing of a Complete Multipart Upload request could take several minutes to complete. 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. Because a request could fail after the initial 200 OK response has been sent, it is important that you check the response body to determine whether the request succeeded.
Note that if
CompleteMultipartUploadfails, applications should be prepared to retry the failed requests. For more information, see Amazon S3 Error Best Practices.Warning
You cannot use
Content-Type: application/x-www-form-urlencodedwith Complete Multipart Upload requests. Also, if you do not provide aContent-Typeheader,CompleteMultipartUploadreturns a 200 OK response.For more information about multipart uploads, see Uploading Objects Using Multipart Upload.
For information about permissions required to use the multipart upload API, see Multipart Upload and Permissions.
CompleteMultipartUploadhas the following special errors:Error code:
EntityTooSmallDescription: 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.
400 Bad Request
Error code:
InvalidPartDescription: One or more of the specified parts could not be found. The part might not have been uploaded, or the specified entity tag might not have matched the part’s entity tag.
400 Bad Request
Error code:
InvalidPartOrderDescription: The list of parts was not in ascending order. The parts list must be specified in order by part number.
400 Bad Request
Error code:
NoSuchUploadDescription: The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.
404 Not Found
The following operations are related to
CompleteMultipartUpload:See also: AWS API Documentation
Request Syntax
object = multipart_upload.complete( MultipartUpload={ 'Parts': [ { 'ETag': 'string', 'ChecksumCRC32': 'string', 'ChecksumCRC32C': 'string', 'ChecksumCRC64NVME': 'string', 'ChecksumSHA1': 'string', 'ChecksumSHA256': 'string', 'PartNumber': 123 }, ] }, ChecksumCRC32='string', ChecksumCRC32C='string', ChecksumCRC64NVME='string', ChecksumSHA1='string', ChecksumSHA256='string', ChecksumType='COMPOSITE'|'FULL_OBJECT', SSECustomerAlgorithm='string', SSECustomerKey='string', RequestPayer='requester', ExpectedBucketOwner='string', RetentionExpirationDate=datetime(2015, 1, 1), RetentionLegalHoldId='string', RetentionPeriod=123 )
- Parameters:
MultipartUpload (dict) –
The container for the multipart upload request information.
Parts (list) –
Array of CompletedPart data types.
If you do not supply a valid
Partwith your request, the service sends back an HTTP 400 response.(dict) –
Details of the parts that were uploaded.
ETag (string) –
Entity tag returned when the part was uploaded.
ChecksumCRC32 (string) –
The Base64 encoded, 32-bit
CRC32checksum of the part. This checksum is present if the multipart upload request was created with theCRC32checksum algorithm. For more information, see Checking object integrity in the Amazon S3 User Guide.ChecksumCRC32C (string) –
The Base64 encoded, 32-bit
CRC32Cchecksum of the part. This checksum is present if the multipart upload request was created with theCRC32Cchecksum algorithm. For more information, see Checking object integrity in the Amazon S3 User Guide.ChecksumCRC64NVME (string) –
The Base64 encoded, 64-bit
CRC64NVMEchecksum of the part. This checksum is present if the multipart upload request was created with theCRC64NVMEchecksum algorithm to the uploaded object). For more information, see Checking object integrity in the Amazon S3 User Guide.ChecksumSHA1 (string) –
The Base64 encoded, 160-bit
SHA1checksum of the part. This checksum is present if the multipart upload request was created with theSHA1checksum algorithm. For more information, see Checking object integrity in the Amazon S3 User Guide.ChecksumSHA256 (string) –
The Base64 encoded, 256-bit
SHA256checksum of the part. This checksum is present if the multipart upload request was created with theSHA256checksum algorithm. For more information, see Checking object integrity in the Amazon S3 User Guide.PartNumber (integer) –
Part number that identifies the part. This is a positive integer between 1 and 10,000.
Note
General purpose buckets - In
CompleteMultipartUpload, when a additional checksum (includingx-amz-checksum-crc32,x-amz-checksum-crc32c,x-amz-checksum-sha1, orx-amz-checksum-sha256) is applied to each part, thePartNumbermust start at 1 and the part numbers must be consecutive. Otherwise, Amazon S3 generates an HTTP400 Bad Requeststatus code and anInvalidPartOrdererror code.Directory buckets - In
CompleteMultipartUpload, thePartNumbermust start at 1 and the part numbers must be consecutive.
ChecksumCRC32 (string) – 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
CRC32checksum of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.ChecksumCRC32C (string) – 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
CRC32Cchecksum of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.ChecksumCRC64NVME (string) – 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, 64-bit
CRC64NVMEchecksum of the object. TheCRC64NVMEchecksum is always a full object checksum. For more information, see Checking object integrity in the Amazon S3 User Guide.ChecksumSHA1 (string) – 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
SHA1digest of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.ChecksumSHA256 (string) – 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
SHA256digest of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.ChecksumType (string) – This header specifies the checksum type of the object, which determines how part-level checksums are combined to create an object-level checksum for multipart objects. You can use this header as a data integrity check to verify that the checksum type that is received is the same checksum that was specified. If the checksum type doesn’t match the checksum type that was specified for the object during the
CreateMultipartUploadrequest, it’ll result in aBadDigesterror. For more information, see Checking object integrity in the Amazon S3 User Guide.SSECustomerAlgorithm (string) –
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.
Note
This functionality is not supported for directory buckets.
SSECustomerKey (string) –
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.
Note
This functionality is not supported for directory buckets.
SSECustomerKeyMD5 (string) –
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.
Note
This functionality is not supported for directory buckets.
Please note that this parameter is automatically populated if it is not provided. Including this parameter is not required
RequestPayer (string) – Ignored by COS if present.
ExpectedBucketOwner (string) – Ignored by COS if present.
RetentionExpirationDate (datetime) – Date on which it will be legal to delete or modify the object. You can only specify this or the Retention-Period header. If both are specified a 400 error will be returned. If neither is specified the bucket’s DefaultRetention period will be used.
RetentionLegalHoldId (string) – A single legal hold to apply to the object. A legal hold is a character long string of max length 64. The object cannot be overwritten or deleted until all legal holds associated with the object are removed.
RetentionPeriod (integer) – Retention period to store on the object in seconds. RetentionPeriod and RetentionExpirationDate are mutually exclusive, if neither is specified the bucket’s DefaultRetentionPeriod value will be used. Indefinite retention(-1) is a valid value. Permanent retention(-2), is valid only if permanent retention is enabled for the bucket. 0 is a valid value if the bucket’s MinimumRetention period is also 0.
- Return type:
s3.Object- Returns:
Object resource