You are currently viewing Cross Region Replication (CRR)

Cross Region Replication (CRR)

Cross Region Replication (CRR)

Hello Everyone

Welcome to CloudAffaire and this is Debjeet

In the last blog post, we have discussed how to enable versioning to AWS S3 bucket.

https://cloudaffaire.com/versioning-in-s3/

In this blog post, we are going to discuss Cross Region Replication or CRR in S3. We are also going to setup CRR between two buckets in different regions.

Cross Region Replication (CRR):

AWS S3 provides cross-region replication or CRR to replicate objects across buckets in different AWS regions. The scope of an S3 bucket is within the region they are created. If you want to copy your objects from one region to another region between buckets, you can leverage the CRR feature of AWS S3. CRR uses asynchronous replication between buckets. Buckets configured for cross-region replication can be owned by the same AWS account or by different accounts.

Prerequisites of setting up cross-region replication

  • A source and destination bucket in a different region
  • Both source and destination buckets must have versioning enabled.
  • Permissions (An AWS IAM role) to replicate objects from the source bucket to the destination bucket.

Note: If the owner of the source and destination bucket is different, the owner of the destination bucket must grant the owner of the source bucket permissions to replicate objects with a bucket policy.

Next, we are going to configure cross-region replication between two S3 buckets.

Setup Cross Region Replication in AWS S3:

Step 1: Login to AWS console and click ‘S3’ located under Storage.

Cross Region Replication - CRR

Note: Create two buckets in different regions with versioning enabled. You can follow the previous two blogs to create versioning enabled bucket.

Warning: Chagres apply depending upon the region and file size.

Step 2: Click on the bucket that will serve as a source in your CRR.

Cross Region Replication - CRR

Note: Our source bucket is in the Asia Pacific and destination bucket is in US East.

Step 3: Navigate to ‘Replication’ located under ‘Management’ and click ‘Add rule’.

Cross Region Replication - CRR

Step 4: Select ‘Entire bucket’ and click ‘Next’.

Cross Region Replication - CRR

Note: You can replicate all of the objects in the source bucket or a subset by providing a key name prefix, one or more object tags, or both in the configuration. CRR also supports encryption with AWS KMS. This demo is for introductory purpose and we will cover advanced features in future blogs.

Step 5: From the destination bucket drop down select your destination bucket and click ‘Next’.

Cross Region Replication - CRR

Step 6: Select ‘Create new role’ and provide a name to the role. Click ‘Next’.

Cross Region Replication - CRR

Note: Permissions (An AWS IAM role) is required to replicate objects from the source bucket to the destination bucket. You can create a new IAM role or use an existing one. But it’s recommended to create a new IAM role.

Step 7: Review the replication rule and click ‘Save’.

Cross Region Replication - CRR

Your new replication rule has been configured successfully

Cross Region Replication - CRR

Note: Replication does not affect the current objects in the bucket but to the future objects

Source bucket

Cross Region Replication - CRR

Destination bucket

Cross Region Replication - CRR

Step 8: Upload a new file with same name and extension to your source bucket.

Cross Region Replication - CRR

Cross Region Replication - CRR

To stop acquiring any cost, delete both the buckets once the demo is completed.

Cross Region Replication - CRR

Hope you have enjoyed this article, in the next blog, we will discuss object lifecycle management in S3.

Leave a Reply