All Products
Search
Document Center

Object Storage Service:upload-part-copy

Last Updated:Mar 20, 2026

Copies data from an existing object as a part and uploads the part. Use this command when copying objects larger than 1 GB as part of a multipart upload workflow.

Usage notes

  • To copy an object smaller than 1 GB with a single command, use copy-object instead.

  • The source and destination buckets must be in the same region.

  • Run initiate-multipart-upload first to get an upload ID from OSS before running this command.

Permissions

By default, an Alibaba Cloud account has full permissions. RAM users and RAM roles have no permissions by default. Grant the required permissions through a RAM Policy or bucket policy.

APIActionDescription
UploadPartCopyoss:GetObjectReads data from the source object
oss:PutObjectWrites data to the destination object
oss:GetObjectVersionReads a specific version of the source object when versionId is specified

Syntax

Required parameters are shown without brackets. Optional parameters are enclosed in [brackets].

ossutil api upload-part-copy
--bucket <value>
--copy-source <value>
--key <value>
--part-number <value>
--upload-id <value>
[--copy-source-if-match <value>]
[--copy-source-if-modified-since <value>]
[--copy-source-if-none-match <value>]
[--copy-source-if-unmodified-since <value>]
[--copy-source-range <value>]
[--metadata-directive <value>]
[--tagging <value>]
[--tagging-directive <value>]
[flags]

Required parameters

ParameterTypeDescription
--bucketstringName of the bucket in which the source object is stored
--copy-sourcestringAddress of the source object. Format: bucket/UrIEncode(key). The object name must be URL-encoded. The source and destination buckets must be in the same region.
--keystringFull path of the source object from which you want to copy data
--part-numberstringPart number that identifies this part in the multipart upload
--upload-idstringUpload ID of the multipart upload task, obtained from initiate-multipart-upload

Optional parameters

ParameterTypeDescription
--copy-source-if-matchstringCopy the data only if the ETag of the source object matches the specified value. Returns 412 Precondition Failed if the condition is not met.
--copy-source-if-modified-sincestringCopy the data only if the source object was modified after the specified time. Returns 200 OK if the condition is met; otherwise returns 304 Not Modified.
--copy-source-if-none-matchstringCopy the data only if the ETag of the source object does not match the specified value. Returns 200 OK if the condition is met; otherwise returns 304 Not Modified.
--copy-source-if-unmodified-sincestringCopy the data only if the source object was not modified after the specified time. Returns 200 OK if the condition is met; otherwise returns 412 Precondition Failed.
--copy-source-rangestringByte range to copy from the source object. Format: bytes=first-last (zero-based byte offsets). For example, bytes=0-9 copies the first 10 bytes.
--metadata-directivestringMethod used to set the metadata of the destination object
--taggingstringTags to apply to the destination object
--tagging-directivestringMethod used to set the tags of the destination object
Note

Note: For supported global flags, see Global command-line options.

Examples

Copy data from a source object as a part

ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1

Copy data in JSON output format

ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1 --output-format json

Copy data in YAML output format

ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1 --output-format yaml

Copy a byte range from the source object

Copy bytes 0 through 9 (the first 10 bytes) from srcobject:

ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1 --copy-source-range bytes=0-9

Copy data with an ETag condition

Copy the data only if the ETag of srcobject is 123:

ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1 --copy-source-if-match 123

Copy data with an unmodified-since condition

Copy the data only if srcobject was not modified after Mon, 11 May 2020 08:16:23 GMT:

ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1 --copy-source-if-unmodified-since "Mon, 11 May 2020 08:16:23 GMT"

Copy data and replace object tags

Copy the data and replace the source object's tags with the specified tags:

ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1 --tagging-directive Replace --tagging "TagA=A&TagB=B"

What's next

The upload-part-copy command corresponds to the UploadPartCopy API operation. For full parameter details, see the API reference.

To complete a multipart upload workflow, use the following commands in sequence: