All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Put Bucket Replication

Last updated:2021-09-14 16:18:08

Description

You can call this operation to configure a replication rule for a source bucket. You can configure only one replication rule for each source bucket. If a replication rule has been configured for a source bucket, the system will prompt you when you attempt to configure another rule for the bucket. After you configure a rule, KS3 automatically replicates matched objects to the destination bucket.

Permission

To call this operation, you must have the PUTBucketReplication permission on the bucket.

Request

Request syntax

PUT /?crr HTTP/1.1  
Host: {BucketName}.{endpoint}  
Date: {date}  
Authorization: {SignatureValue}  
Content-length: {length}  
Content-MD5: {md5}   

<Replication xmlns="http://s3.amazonaws.com/doc/2006-03-01/">  
    <prefix>prefix1</prefix>  
    <prefix>prefix2</prefix>  
    <DeleteMarkerStatus>Enabled</DeleteMarkerStatus>  
    <targetBucket>bucketname</targetBucket>
</Replication>

Request parameters

This operation does not involve request parameters.

Request headers

Parameter Description Required
Content-MD5 The 128-bit MD5 digest of data that is Base64-encoded. You must include the Content-MD5 header in the request to verify that the request body is not corrupted. For more information, see RFC-1864.
Type: String
Default value: none
Yes

Request body

The request body describes the replication configuration and is in XML format.

<Replication xmlns="http://s3.amazonaws.com/doc/2006-03-01/">  
    <prefix>prefix1</prefix>  
    <prefix>prefix2</prefix>  
    <DeleteMarkerStatus>Enabled</DeleteMarkerStatus>  
    <targetBucket>bucketname</targetBucket>
</Replication>

The following table describes the parameters in the request body.

Parameter Description Required
Replication The container of the replication rule. You can configure only one rule for a source bucket.
Type: Container
Child node: none
Parent node: none
Yes
prefix The prefix for matching objects. Only the objects matching the prefix are replicated. You can add up to 10 prefixes for a replication rule, and the prefixes must be unique.
Type: String
Parent node: Replication
No
DeleteMarkerStatus Specifies whether to enable deletion replication. If this parameter is set to Enabled, deletion replication is enabled. When an object is deleted from the source bucket, the object replica in the destination bucket is also deleted. If this parameter is set to Disabled or is unspecified, deletion replication is disabled.
Type: String
Parent node: Replication
No
targetBucket The destination bucket for replication.
Type: String
Parent node: Replication
Yes

Note:

  • KS3 supports cross-region replication and same-region replication. However, you can configure only one replication rule for each source bucket, that is, either a cross-region replication rule or a same-region replication rule.

  • KS3 supports two-way replication, that is, a source bucket can also serve as a destination bucket of its destination bucket.

  • Before enabling replication for a bucket, make sure that no replication is enabled between the bucket and other buckets. For example, if you have enabled replication from Bucket A to Bucket B, you cannot enable replication from Bucket A to Bucket C unless you disable the replication from Bucket A to Bucket B. Similarly, if replication from Bucket A to Bucket B is enabled, you cannot enable replication from Bucket C to Bucket B.

  • You can add up to 10 prefixes for a replication rule, and the prefixes must be unique.

  • Objects in the destination bucket are the exact replicas of those in the source bucket. They have the same object names, metadata, and content as the source objects, such as the same creation time, owner, storage class, user-defined metadata, object ACL, object content, and object encryption method (using a KS3-managed key). Therefore, any changes of the preceding data are synchronized to the destination bucket.

  • Objects replicated to the destination bucket conform to the lifecycle rule of the destination bucket.

  • Before you delete a bucket with replication enabled, you must disable replication.

  • The priority of replication is higher than that of lifecycle management. An object is replicated to the destination bucket before the lifecycle management operation is performed on the object, to comply with the principle of data security preceding data management.

  • The following objects and data are not replicated:
    • Data encrypted by the client.
    • New data in the source bucket that is replicated from other buckets.
    • Bucket configuration updates, which do not affect the objects in the bucket.
    • Archive objects, unless the object content changes.

Response

Response headers

This operation involves only common response headers. For more information, see Public Response Header.

Response body

No response body is returned.

Operation-specific errors

Error Code Description HTTP Status Code
NoSuchBucketReplicationConfiguration No replication rule is configured for the bucket. 404 Not Found
Invalid Argument A replication rule has been configured for the bucket.
The request body is in an invalid format.
The number of prefixes exceeds 10.
The length of the prefix exceeds the limit.
The prefix contains special characters.
400 Invalid Argument

Examples

Sample request

PUT /?crr HTTP/1.1
Host: ks3-example.ks3-cn-beijing.ksyuncs.com
Date: Wed, 14 May 2014 02:11:21 GMT
Content-MD5: xxx 
Authorization: authorization string
Content-Length: yyy
Content-type: application/xml

<Replication>
    <prefix>abc</prefix>
    <prefix>xyz</prefix>
    <DeleteMarkerStatus>Enabled</DeleteMarkerStatus>
    <targetBucket>targetbucket</targetBucket>
</Replication>

In this example, a replication rule is configured for a bucket, two prefixes abc and xyz are configured for the replication rule, deletion replication is enabled, and the destination bucket is targetbucket.

Sample response

HTTP/1.1 200 OK
Content-Length: 0
Date: Tue, 19 Jul 2017 09:14:23 GMT
Server: Tengine
x-kss-request-id: 6af24440694b4d00b8de063ccbe86336
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback