Configuring Cross-Region Replication for a Bucket
Functions
Cross-region replication refers to the automatic and asynchronous replication of objects across buckets in different regions. By activating cross-region replication, OBS can copy new objects and modified objects from a source bucket in one region to a destination bucket in a different region.

An IAM agency is required for configuring cross-region replication. For details, see Creating an Agency for Cross-Region Replication.
To configure cross-region replication for a bucket, the following two requirements must be met:
- The versioning statuses of the source and destination buckets are the same. For details, see Configuring Versioning for a Bucket.
- The source bucket's owner and agency (OBS) have the write permission for the destination bucket (with a bucket policy configured), and the agency (OBS) also has the read permission for the source bucket. This permission delegation needs to be implemented by using a bucket policy.
For details about how to configure the bucket policy, see Configuring a Bucket Policy. After the bucket policy is set, the agency (OBS) can read objects from the source bucket and copy objects to the destination bucket.
Request Syntax
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
PUT /?replication HTTP/1.1 Host: bucketname.obs.region.myhuaweicloud.com x-obs-date: date Content-SHA256: SHA256 Authorization: authorization string Content-Length: contentlength <ReplicationConfiguration> <Agency>testAcy</Agency> <Rule> <ID>rule1</ID> <Prefix>key-prefix</Prefix> <Status>rule-status</Status> <Destination> <Bucket>targetbucketname</Bucket> <StorageClass>STANDARD</StorageClass> <DeleteData>Enabled</DeleteData> </Destination> <HistoricalObjectReplication>Enabled</HistoricalObjectReplication> </Rule> </ReplicationConfiguration> |
Request Parameters
This request contains no message parameters.
Request Headers
The request uses one header, as described in the following table.
Parameter |
Mandatory (Yes/No) |
Type |
Description |
---|---|---|---|
Content-SHA256 |
Yes |
string |
Definition: SHA-256 digest string of the message body, that is, the string obtained after the 256-bit SHA-256 value of the message body is encoded using Base64 Range: None Default value: None |
Request Elements
The request body contains elements to specify the replication configuration for the bucket in XML format. The following table lists request elements:
Parameter |
Mandatory (Yes/No) |
Type |
Description |
---|---|---|---|
ReplicationConfiguration |
Yes |
Container |
Definition: Container of cross-region replication rules. ReplicationConfiguration is the parent node of Rule and Agency. Constraints:
Range: None Default value: None |
Rule |
Yes |
Container |
Definition: Container of a specified cross-region replication rule. Constraints: A bucket can have 1 to 100 cross-region replication rules. Range: For details, see Table 3. Default value: None |
Agency |
Yes |
String |
Definition: Name of the agency created by the user for cross-region replication. Constraints: None Range: The value is a string of 0 to 64 characters. Default value: None |
Parameter |
Mandatory (Yes/No) |
Type |
Description |
---|---|---|---|
ID |
No |
String |
Definition: ID of the cross-region replication rule. Constraints: The rule ID must be unique. Range: The value is a string of 0 to 255 characters. Default value: None |
Status |
Yes |
String |
Definition: Whether to enable the cross-region replication rule. Constraints: None Range:
Default value: None |
Prefix |
Yes |
String |
Definition: The prefix of an object name, applicable to one or more objects. Constraints:
Range: The value is a UTF-8 string of 1 to 1024 characters. Default value: None |
Destination |
Yes |
Container |
Definition: Container for the destination bucket information. Constraints: None Range: For details, see Table 4. Default value: None |
HistoricalObjectReplication |
No |
String |
Definition: Whether to replicate historical objects that meet the cross-region replication rule. Constraints: None Range:
Default value: If this parameter is not set, Disabled is used by default. |
Parameter |
Mandatory (Yes/No) |
Type |
Description |
---|---|---|---|
Bucket |
Yes |
String |
Definition: Name of the destination bucket for cross-region replication. The bucket is used to store object copies identified by the cross-region replication rule. Constraints: If the replication configuration contains multiple rules, the rules must specify the same bucket as the destination bucket. Range: The value can contain 3 to 63 characters. Default value: None |
StorageClass |
No |
String |
Definition: The storage class to which objects replicated to the destination bucket will be changed. Constraints: None Range:
Default value: None |
DeleteData |
No |
String |
Definition: Whether to synchronously delete objects with the same names in the destination bucket through cross-region replication after the objects in the source bucket are deleted. Constraints: None Range:
Default value: If this parameter is not set, Disabled is used by default. |
Response Syntax
1 2 3 4 |
HTTP/1.1 status_code Server: OBS Date:date Content-Length: contentlength |
Response Headers
The response to the request uses common headers. For details, see Table 1.
Response Elements
This response contains no elements.
Error Responses
No special error responses are returned for this request.
Sample Request
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
PUT /?replication HTTP/1.1 User-Agent: curl/7.29.0 Host: examplebucket.obs.region.myhuaweicloud.com Accept: */* Date: Wed, 27 Jun 2018 13:39:15 +0000 Authorization: OBS H4IPJX0TQTHTHEBQQCEC:CdeqU0Vg9xNdJMZ0PGPgh5EnkO0= Content-SHA256: ogX9qClMrVJUBiUSIKDFM0qO41jJM0I5SCN55/OtMyI= Content-Length: 330 <ReplicationConfiguration> <Agency>testAcy</Agency> <Rule> <ID>Rule-1</ID> <Status>Enabled</Status> <Prefix></Prefix> <Destination> <Bucket>dstbucket</Bucket> <StorageClass>STANDARD</StorageClass> <DeleteData>Enabled</DeleteData> </Destination> <HistoricalObjectReplication>Enabled</HistoricalObjectReplication> </Rule> </ReplicationConfiguration> |
Sample Response
1 2 3 4 5 6 |
HTTP/1.1 200 OK Server: OBS x-obs-request-id: B59500000164417839932E5A2295674C x-obs-id-2: 32AAAQAAEAABKAAQAAEAABAAAQAAEAABCStv51t2NMMx+Ou+ow7IWV4Sxo231fKe Date: Wed, 27 Jun 2018 13:39:15 GMT Content-Length: 0 |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot