AWS Cross Region Replication
Cross Region Replication refers to the ability of replicating the objects from one AWS S3 bucket to another AWS S3 bucket in a different region.
Few Pre-requisites to enable Cross Region Replication:
- Two AWS S3 buckets in different region.
- Enable versioning on both the buckets.
- Data Already in the source bucket isn’t replicated, any subsequent object files will be replicated asynchronously.
- Delete makers aren’t replicated.
Step 1: Login to AWS Management Console, we have a bucket named ‘srcipwithease’ in N.Virginia region already created.
This bucket doesn’t have versioning enabled as below:
In order to setup CRR we need to enable Versioning on the Source Bucket.
Step2: Goto Management Tab of the bucket > Click on Replication > Click Get Started
Step 3: Enable Versioning on the next window. You can either replicate the entire bucket or tags to the destination bucket. Suppose you want to replicate the entire bucket and then click on the Next.
Enter the Destination Bucket on Next Window and Click on Create New Bucket.
On next window enter the name of the destination bucket, and assign this bucket a different region. We named it as ‘dstipwithease’ and in region Apac(Mumbai). Click Next.
On the next window create a new IAM role to allow for the Replication to happen. Click Create Role & then enter name of Role and Click Next.
Review the settings and Click Save
Once you click save you will see the replication has been setup successfully as below.
Now if we browse to the S3, we can see our Source and Destination buckets already created as below:
At the moment we don’t have any objects available in the source bucket to be replicated, hence let’s go ahead and add an object to bucket srcipwithease.
We uploaded the file named logo and can been seen in source bucket as below:
The object wont’ be public by default, hence lets go ahead and make the object as Public.
Step 4: Go ahead and check if the object is replicated in the destination bucket, you shall be able to see the object is replicated to the destination region as below:
Step 5: Now let us go to the source bucket and delete the original object from and see if its delete’s the file from destination bucket as well.
You see the object is deleted from the source bucket.
Now if you browse to the destination bucket, you can still see the object in there which proves that delete markers aren’t replicated across regions.
You can also see under IAM a role that was created to allow for the replication as below:
Related – AWS S3 Replication