Same-region replication (SRR) enables the automatic and asynchronous (near real-time) replication of objects across buckets within the same region. Operations such as the creation, overwriting, and deletion of objects can be synchronized from a source bucket to a destination bucket.
If your data cannot be transferred out of your country or region based on the compliance requirements of local laws and regulations, you can configure SRR rules to store the replicas of data in the source bucket in multiple destination buckets within the same region. Objects in a destination bucket are exact replicas of those in a source bucket. They have the same object names, versioning information, object content, and object metadata such as the creation time, owner, user metadata, and access control lists (ACLs).
SRR supports the following features:
- Data synchronization between buckets in the same region
You can configure SRR rules to synchronize data from a source bucket to multiple destination buckets in the same region. By default, you can configure up to 100 SRR rules for a bucket. The bucket can be specified as a source bucket or a destination bucket.
If you want to configure more than 100 SRR rules for a bucket, contact technical support.
- Real-time data synchronization
You can configure SRR rules to monitor data that is added, removed, or modified in real time and synchronize these changes to a destination bucket. Operations performed on objects that are smaller than 2 MB are synchronized within minutes to ensure data consistency between the source and destination buckets.
- Historical data migration
Historical data can be synchronized from a source bucket to a destination bucket. This way, two identical data replicas are individually stored in the source and destination buckets.
- Real-time display of the synchronization progress
You can view the last synchronization time for real-time data synchronization and the percentage of synchronization for historical data migration.
SRR ensures eventual consistency between the data in source and destination buckets for which versioning is enabled. If you configure an SRR rule to synchronize only added and modified data, delete operations performed on the specified version of an object in the source bucket are not synchronized to the destination bucket. However, delete markers created in the source bucket are synchronized to the destination bucket.
After SRR is enabled, you are not charged for the traffic that is generated when you use SRR to replicate objects in Object Storage Service (OSS). Each time an object is synchronized, OSS accumulates the number of requests. However, you are not charged for the requests.
- Replication time
In SRR, data is replicated asynchronously. Depending on the size of the data, it can take anywhere from a few minutes to several hours to replicate data to the destination bucket.
- You can configure CRR between two unversioned buckets or two versioned buckets.
- The versioning status of two buckets between which a CRR rule is configured cannot be changed.
- If you configure a CRR rule for two buckets, an object replicated from the source bucket may overwrite an object that has the same name in the destination bucket.
Use the OSS console
- Log on to the OSS console.
- In the left-side navigation pane, click Buckets. On the page that appears, click the name of the bucket for which you want to enable SRR.
- In the left-side navigation pane, choose .
- In the Same-Region Replication section, click Configure.
- Click Same-Region Replication.
- In the Same-Region Replication panel, configure the parameters described in the following table.
Parameter Description Source Region The region in which the current bucket is located. Source Bucket The name of the current bucket. Destination Bucket Select the destination bucket to which you want to synchronize data. Applied To Select the source data that you want to synchronize.
- All Files in Source Bucket: OSS synchronizes all objects from the source bucket to the destination bucket.
- Files with Specified Prefix: OSS synchronizes the objects whose names contain a specified prefix from the source bucket to the destination bucket. You can specify up to 10 prefixes.
Object Tagging The tags of objects that you want to synchronize to the destination bucket. Objects that have the specified tags are synchronized to the destination bucket. Select Configure Rules and add tags in key-value pairs. You can add up to 10 tags.
To configure this parameter, make sure that the following conditions are met:
- Tags are configured for objects. For more information, see Configure object tagging.
- Versioning is enabled for the source bucket and the destination bucket.
- The Operations parameter is set to Add/Change.
Operations Select the operations to synchronize.
- Add/Change: OSS synchronizes only the added or changed data from the source bucket to the destination bucket.
- Add/Delete/Change: OSS synchronizes all data changes including the create, overwrite, and delete operations on objects from the source bucket to the destination bucket.
Replicate Historical Data Specifies whether to synchronize historical data in the source bucket before you enable SRR for the source bucket.
- Yes: OSS synchronizes historical data to the destination bucket.
Notice When historical data is synchronized, objects in the source bucket may overwrite objects that have the same names in the destination bucket. To avoid data loss, we recommend that you enable versioning for the source and destination buckets.
- No: OSS synchronizes only objects that are uploaded or updated after the SRR rule takes effect to the destination bucket.
KMS-based Encryption If KMS-based encryption is configured for the source objects or destination bucket, you must select KMS-based Encryption and configure the following parameters:
- CMK ID: The customer master key (CMK) that is used to encrypt the destination object.
If you want to use a CMK to encrypt objects, you must create a CMK in the same region as the destination bucket in the Key Management Service (KMS) console. For more information, see Create a CMK.
- RAM Role Name: The RAM role that is authorized to perform KMS-based encryption on the destination
- New RAM Role: A RAM role is created to perform KMS-based encryption on the destination object.
The name of the RAM role is in the following format:
kms-replication-source bucket name-destination bucket name.
- AliyunOSSRole: The AliyunOSSRole role is used to perform KMS-based encryption on the destination object. If the AliyunOSSRole role does not exist, OSS automatically creates the AliyunOSSRole role when you select this option.
- New RAM Role: A RAM role is created to perform KMS-based encryption on the destination object. The name of the RAM role is in the following format:
- Click OK.
- An SRR rule cannot be edited or deleted after it is created.
- The synchronization starts immediately after an SRR rule is configured. You can view the synchronization progress on the Same-Region Replication page.
- It can take several minutes to several hours for the data to be synchronized to the destination bucket based on the amount of data.
Use the RESTful API
If your business requires a high level of customization, you can directly call RESTful APIs. To directly call an API, you must include the signature calculation in your code. For more information, see PutBucketReplication.