Cross-Region Replication (CRR) automatically and asynchronously replicates objects from a source bucket in one region to a destination bucket in another region within the same Alibaba Cloud account. Object creation, update, and deletion operations are replicated nearly in real time. This topic describes how to configure CRR for buckets that belong to the same account.
Prerequisites
You have created a source bucket in a region under your Alibaba Cloud account. Record the account UID, the source bucket name, and its region.
You have created a destination bucket in a different region under the same Alibaba Cloud account. Record the destination bucket name and its region.
Role types
To perform CRR, you must specify a RAM role that Object Storage Service (OSS) can assume to replicate objects from the source bucket to the destination bucket. You can select one of the following role types for the replication.
You can use a RAM user to create the role. The RAM user must have the following permissions: ram:CreateRole, ram:GetRole, ram:ListPoliciesForRole, and ram:AttachPolicyToRole. However, granting role-related permissions such as ram:CreateRole and ram:GetRole to a RAM user poses security risks. We recommend that you use the parent Alibaba Cloud account to create and authorize the RAM role, which the RAM user can then assume.
(Recommended) new RAM role
When creating a CRR rule, you can create a new RAM role for the replication. OSS automatically creates a role named oss-replication-{uuid} and attaches different permission policies depending on whether you replicate objects encrypted with Key Management Service (KMS).
Replicate KMS-encrypted objects
After creating the role, grant it the required permissions as prompted. Once authorized, the role receives a fine-grained permission policy for replication from the source bucket to the destination bucket and the AliyunKMSCryptoUserAccess policy for managing Key Management Service (KMS).
Do not replicate KMS-encrypted objects
After creating the role, grant it the required permissions as prompted. Once authorized, the role receives a fine-grained permission policy for replication from the source bucket to the destination bucket.
AliyunOSSRole
When you create a CRR rule, you can select the AliyunOSSRole to perform the replication. OSS attaches different permission policies to the role based on whether you choose to replicate KMS-encrypted objects.
Replicate KMS-encrypted objects
If you select AliyunOSSRole, OSS automatically attaches the following permission policies to the role: AliyunOSSFullAccess (permissions to manage Object Storage Service) and AliyunKMSCryptoUserAccess (permissions to manage Key Management Service).
WarningThis role has broad permissions, allowing all operations on all buckets and KMS resources under the current account. Use this role with caution.
Do not replicate KMS-encrypted objects
If you select AliyunOSSRole, OSS automatically attaches AliyunOSSFullAccess (permissions to manage Object Storage Service) to the role.
WarningThis role has broad permissions, allowing all operations on all buckets under the current account. Use this role with caution.
Custom role
When you create a CRR rule, you can use a custom role for the replication. You must create the custom role in the Resource Access Management (RAM) console and grant the required permissions to the role.
Create a regular service role.
During role creation, select Alibaba Cloud Service as the trusted entity and Object Storage Service as the trusted service. For more information, see Create a regular service role.
Grant permissions to the role.
You can use one of the following methods to grant permissions to the role.
System policy
WarningYou can attach the
AliyunOSSFullAccesssystem policy to the RAM role. By default,AliyunOSSFullAccessgrants full permissions on all buckets within the current account. Use this policy with caution.To replicate KMS-encrypted objects, you must also attach the
AliyunKMSFullAccesssystem policy to the role.For more information, see Grant permissions to a RAM role.
Custom policy
Use a RAM policy to grant the RAM role the minimum permissions required for replication from the source bucket (src-bucket) to the destination bucket (dest-bucket).
NoteReplace the source and destination bucket names with the actual names of your buckets.
{ "Version":"1", "Statement":[ { "Effect":"Allow", "Action":[ "oss:ReplicateList", "oss:ReplicateGet" ], "Resource":[ "acs:oss:*:*:src-bucket", "acs:oss:*:*:src-bucket/*" ] }, { "Effect":"Allow", "Action":[ "oss:ReplicateList", "oss:ReplicateGet", "oss:ReplicatePut", "oss:ReplicateDelete" ], "Resource":[ "acs:oss:*:*:dest-bucket", "acs:oss:*:*:dest-bucket/*" ] } ] }For more information, see Grant permissions to a RAM role.
NoteTo replicate KMS-encrypted objects, you must also attach the
AliyunKMSFullAccesssystem policy to the role.
When you replicate data across regions within the same account, OSS validates only the permission policy of the RAM role used for replication. OSS does not validate the bucket policies on the source or destination buckets.