Updated on 2024-07-24 GMT+08:00

Cross-Region Replication

Scenarios

Cross-region replication provides the capability for disaster recovery across regions, allowing you to set up a remote backup solution.

Cross-region replication refers to the process of automatically and asynchronously replicating data from a bucket (source bucket) to another bucket (destination bucket) across regions by creating a cross-region replication rule. The source bucket and destination bucket must belong to the same account. Replication across accounts is not supported.

For a cross-region replication rule, you can configure it to match a pre-defined object prefix so that all objects with this prefix will be replicated. Alternatively, you can configure the rule to apply to the whole bucket so that all objects in the bucket will be replicated. Objects replicated to the destination bucket are precise copies of objects in the source bucket. They have the same object names, metadata, content, size, last modification time, creator, version ID, user-defined metadata, and ACLs. By default, the storage class of an object copy is the same as that of the source object. You can also specify a different storage class for an object copy.

Figure 1 Cross-region replication
  • Regulatory compliance

    OBS stores data across AZs that are relatively far apart from each other. However, regulatory compliance may require further distances. Cross-region replication enables OBS to replicate data across regions for regulatory compliance.

  • Minimized latencies

    The same OBS resources may need to be accessed from different locations. To minimize the access latency, you can use cross-region replication to create object copies in the region nearest to end users.

  • Data replication

    Cross-region replication allows you to easily migrate your data stored in OBS from one region to another.

  • Data backup and disaster recovery

    To ensure data security and availability, you need to create explicit backups for all data written to OBS in the data center of another region, so that secure backup is available in case the source data is damaged irrevocably.

  • Easy maintenance

    You have a computing cluster across regions to analyze the same collection of objects. You need to maintain object replicas in the two regions.

    OBS allows you to replicate the service data stored in OBS to a specified region, but Huawei Cloud does not detect the stored data and is not responsible for the legal compliance of your use of OBS. If your replication involves cross-border transfer, ensure that your use complies with relevant laws and regulations.

Content Replicated

With cross-region replication enabled, OBS will replicate the following objects to a destination bucket:

  • Newly uploaded objects (excluding objects in the Archive, or Deep Archive storage class)
  • Updated objects, for example, objects whose content or ACL is updated
  • Historical objects in a bucket with Synchronizing Existing Objects enabled (excluding objects in the Archive or Deep Archive storage class)

For example, on July 28, you enabled cross-region replication for a source bucket and uploaded objects A and B to the bucket. Objects A and B were synchronously replicated to the destination bucket. On July 29, you uploaded object C to the source bucket. This time, only object C was replicated to the destination bucket. On July 30, you modified object A in the source bucket. Then, only object A was replicated to the destination bucket.

Cross-region replication does not replicate objects encrypted using SSE-C.

Constraints

Bucket versions

  • Currently, only buckets of version 3.0 support cross-region replication. To check the bucket version, go to the Overview page of the bucket on OBS Console. Then you can view the bucket version in the Basic Information area.

Versioning status of source and destination buckets

  • The versioning status of the source bucket must be the same as that of the destination bucket.

Functions

  • If objects in the source bucket are in the Archive, or Deep Archive storage class, they cannot be copied to the destination bucket.
  • If the region where the destination bucket resides does not support different storage classes for data, object copies will be stored in the Standard storage class.
  • OBS currently only supports the replication between one source bucket and one destination bucket. Replication from one source bucket to multiple destination buckets is not supported. The destination bucket can be modified. However, modifying the destination bucket will change the destination bucket of all existing rules.
  • If cross-region replication is enabled, data cannot be added to the end of objects in the source bucket.
  • For a source bucket, you can create only one cross-region replication rule that applies to the whole bucket for replication of all objects in the bucket. However, you can create a maximum of 100 cross-region replication rules based on object prefixes for the replication of objects that match the prefixes.

Time

  • A cross-region replication rule may not take effect immediately upon its configuration. Accordingly, the objects that this rule is applied to may not be replicated immediately after the rule is configured.

Regions

  • The source and destination buckets must be in two different regions. Data cannot be replicated between buckets in the same region.
  • Before replicating data, ensure that source and destination regions can have their data replicated from each other. Figure 2 lists the supported regions. "√" indicates that data can be replicated between regions. "x" indicates that data cannot be replicated between regions.
    Figure 2 Replication support between regions

Synchronization of historical objects

  • By default, objects uploaded before cross-region replication is enabled are not copied to the destination bucket unless the function for synchronizing existing objects is enabled.
  • If the function for synchronizing existing objects is enabled, modifying the cross-region replication configuration may cause failures in synchronizing existing objects. Therefore, do not modify the cross-region replication configuration before the synchronization finishes.

Versioning

  • If versioning is enabled or suspended for both the source and destination buckets and cross-region replication is also enabled for both buckets, deleting an object without specifying its version in the source bucket will also delete the object in the destination bucket.
  • If you change the versioning status of the destination bucket when cross-region replication is enabled, the replication of objects will fail. If you want to change the versioning status of the source bucket, disable the cross-region replication first, and then make the change.

Access control

  • Ensure that owners of the source and destination buckets have the read and write permissions to the two buckets. Otherwise, data cannot be synchronized. If the system does not have the permissions to read the source bucket or write the destination bucket due to read/write permission errors, objects cannot be copied successfully, and such replication will not be resumed even if the permission error is rectified.
  • Do not delete, overwrite object replicas in the destination bucket, or modify their ACLs, which may cause inconsistency of latest object versions or permission control settings between the destination bucket and the source bucket.
  • After a replication with Synchronize Existing Objects enabled is complete, if the replication policy keeps unchanged, any ACL changes of source objects will be synchronized to object copies. However, ACL changes of source historical objects will not be synchronized to the copies of historical objects.

Others

  • Objects in a source bucket can be copied to only one destination bucket, and cannot be copied again from the destination bucket to another bucket. For example, bucket A and bucket B are in two different regions. You can copy data from bucket A to bucket B or the other way round. However, data copies in either bucket A or bucket B cannot be replicated anymore.
  • If you delete the OBS agency configuration in a cross-region replication, the replication status becomes Failed.

How to Use

You can use OBS Console, SDKs, obsutil, or APIs to configure cross-region replication.

Tool

Reference

OBS Console

Configuring Cross-Region Replication

SDKs

OBS supports software development kits (SDKs) in multiple languages. For details, see the corresponding developer guide on the SDK Overview page.

API

Configuring Cross-Region Replication for a Bucket

obsutil

Copying an Object