Monday , October 14 2019

Build Your Own LAB – Cross-Region Replication for AWS S3

Cross-Region replication feature enables asynchronous automatic replication of copying objects between two AWS regions. You need to enable this feature on bucket level and configure on source bucket. This feature allows you to either select the whole source or subset of an object to replicate on destination region.

image

Important things to keep in mind:

· Cross-region will not work if versioning feature is not enabled on the bucket

· You cannot replicate bucket within the same region and hence it must be between two different regions

· Existing files within in the bucket are not replicated, when enabled cross-region feature. All the objects and subset which are created post enabling cross-region replication will be replicated.

· You cannot replicate the S3 bucket to the third region

· Objects which are marked as deleted are also replicated

Let’s do the LAB, we will create two S3 bucket called apmumbucket (source in Asia Pacific India region) & apsgbucket (destination in Asia Pacific Singapore region) and using the cross-region replication feature will replicate the object.

Go to the Amazon S3 console and create a new bucket

image

Create a bucket called apmumbucket and select the region Asia Pacific (Mumbai)

image

Versioning is must and hence we will enable it and proceed further

image

Enabling read permission here is not mandatory but just to access from internet I am selecting read permission, you can ignore this option

image

Review the settings and click on create bucket

image

Let us upload one file

image

Observe the file is uploaded in the bucket called apmumbucket

image

Let us now create another bucket in Singapore region where we want to replicate the content from Mumbai Region. Just review the summary as I am creating a bucket called apsgbucket

image

Now we can see both the buckets are created in cross-region (Mumbai & Singapore) & let’s enable the feature

image

Go to the bucket property of apmumbucket which is our source and look for the option cross-region replication

image

Enable it and verify the below settings:

· Source – Select Asia Pacific (Mumbai)

o Whole Bucket – Under this bucket we have the option to select the whole or sub buckets if available. We will select whole bucket

· Destination – Select Asia Pacific (Singapore)

o Bucket name – The bucket in which you want to replicate. We will select the one which we created apsgbucket

· Destination Storage Class – Type of storage class what we learned in previous article. Since this is the secondary or replica copy we will select infrequent access class.

· Role – Either it will create by default one for you or we can create our own. Will leave the default settings.

image

You can select other than whole bucket

image

You have the option to select different storage class

image

Now the cross-region replication is enabled

image

Let us see now if we can see anything under the bucket apsgbucket as we have uploaded one file as mentioned above. Any object prior to enabling the cross-region feature isn’t replicated.

image

Let us know try to upload a new file in bucket apmumbucket and see if it replicates on the bucket apsgbucket

image

Verify the settings and upload

image

File upload is successful in bucket apmumbucket, let us now quickly go to the bucket apsgbucket to see if the file is replicate or not.

image

The file now is automatically replicated

image

Also there is only one version of the file. Now let us download the file from bucket apmumbucket (APAC Mumbai region) and modify the content and upload another version. We will see if that is replicated too in Singapore region bucket

image

There is a file name called test file.txt, download the file and modify it. Save it and again upload it to the bucket apmumbucket

image

image

We see there are now two versions for the file test file.txt

image

Notice the same file replicate with the latest versions too 😀

image

About Charles Derber

Charles Derber is an IT Consultant, Volunteer & Speaker. He is Passionate about IT Technology & has an experience for a Decade in this Industry. His expertise is consulting on IT Infrastructure & Cloud, helping customers all over the world to plan, design & implement.

Check Also

Planning your Network on AWS Infrastructure (Virtual Private Cloud) – Part 1

I cannot stress how important is to plan you’re networking which is one of the ...

Leave a Reply

Your email address will not be published.