PUT Bucket replication

Last updated: 2020-09-01 16:48:49


    This API is used to configure a cross-region replication rule for a bucket where versioning is enabled. If there is already a rule for the bucket, the existing one will be overwritten.


    • To use this API, make sure that the bucket has versioning enabled. For more information, see the API documentation PUT Bucket versioning.
    • Currently, for a MAZ-enabled bucket, you can only delete expired objects, but not transition them to the STANDARD_IA or ARCHIVE storage class.


    Sample request

    PUT /?replication HTTP/1.1
    Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
    Date: GMT Date
    Content-MD5: MD5
    Authorization: Auth String
    request body


    Authorization: Auth String (see Request Signature for details).

    Request headers

    This API only uses common request headers. For more information, see Common Request Headers.

    Request body

    The request body contains the configuration information for cross-region replication, including the status of the cross-region replication rule, content to be replicated, and the name and the region of the destination bucket.


    The nodes are described in details below:

    Node Name (Keyword) Parent Node Description Type Required
    ReplicationConfiguration None Contains all information about the cross-region configuration Container Yes
    Role ReplicationConfiguration Initiator ID: qcs::cam::uin/<OwnerUin>:uin/<SubUin> String Yes
    Rule ReplicationConfiguration Replication rules up to 1,000 Container Yes
    ID ReplicationConfiguration.Rule ID that identifies a rule String No
    Status ReplicationConfiguration.Rule Indicates whether a rule is in effect. Enumerated values: Enabled, Disabled String Yes
    Prefix ReplicationConfiguration.Rule Prefix to be matched in the rule. Prefixes cannot overlap; otherwise, an error will be returned. The prefix matching root directory is empty String Yes
    Destination ReplicationConfiguration.Rule Destination bucket information Container Yes
    Bucket ReplicationConfiguration.Rule.Destination Resource ID:
    String Yes
    StorageClass ReplicationConfiguration.Rule.Destination Storage class. Enumerated values: STANDARD, STANDARD_IA. It is the same as that of the source object by default.
    Note: currently, cross-region replication does not allow replicating an object directly into the ARCHIVE storage class. To store your object copies in ARCHIVE, you should configure lifecycle management on the destination bucket. For details, see PUT Bucket lifecycle
    String No


    Response headers

    This API only returns common response headers. For more information, see Common Response Headers.

    Response body

    The response body is empty.

    Error codes

    This API returns uniform error responses and error codes. For more information, see Error Codes.



    The following PUT Bucket replication request adds a cross-region replication configuration to the bucket originbucke-1250000000, specifying that objects prefixed with testPrefix are to be replicated to the destination bucket destinationbucket-1250000000 in Guangzhou.

    PUT /?replication HTTP/1.1
    Date: Mon, 28 Aug 2017 02:53:38 GMT
    Authorization: q-sign-algorithm=sha1&q-ak=AKIDZfbOAo7cllgPvF9cXFrJD0a1ICvR****&q-sign-time=1503888878;1503889238&q-key-time=1503888878;1503889238&q-header-list=host&q-url-param-list=replication&q-signature=254bf9cd3d6615e89a36ab652437f9d45c5f****
    Content-MD5: AAq9nzrpsz5LJ4UEe1f6Q==
    Host: originbucket-1250000000.cos.ap-guangzhou.myqcloud.com
    Content-Length: 312


    After the request above is made, COS returns the following response, indicating that the cross-region replication rule has been successfully configured.

    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 0
    Connection: keep-alive
    Date: Fri, 14 Apr 2019 07:06:19 GMT
    Server: tencent-cos
    x-cos-bucket-region: ap-guangzhou
    x-cos-request-id: NWQwMzQ3NmJfMjRiMjU4NjRfOTM4NV82ZDU1****

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback