AWS - S3 Replication


In this post will see what is s3 replication and how to use it.

Replication enables automatic, asynchronous copying of objects across Amazon S3 buckets. 

Buckets that are configured for object replication can be owned by the same AWS account or by different accounts.

You can replicate objects to a single destination bucket or to multiple destination buckets. The destination buckets can be in different AWS Regions or within the same Region as the source bucket.

To automatically replicate new objects as they are written to the bucket, use live replication, such as Cross-Region Replication (CRR). 

To replicate existing objects to a different bucket on demand, use S3 Batch Replication.

To enable CRR, you add a replication configuration to your source bucket. The minimum configuration must provide the following:

The destination bucket or buckets where you want Amazon S3 to replicate objects.

An AWS Identity and Access Management (IAM) role that Amazon S3 can assume to replicate objects on your behalf.

I am going to create 2 buckets:

us-east-1: Source bucket.

us-east-2: Destination bucket.



We need to enable versioning on both the source and destination buckets for replication to work.

Let's proceed with creating the replication rule. From the source bucket.





We have selected the source and destination buckets.

During the replication setup, we can make changes like what storage class to be used at the destination bucket.

 


Other parameters:



We are done with the setup. So, when the objects are uploaded to the source bucket they will be replicated to the destination bucket within 15 mins (RTC - Replication Time Control).

I am uploading a file to the source bucket.


Within minutes you should see them replication on the destination bucket.



Now, What happens when the destination file is deleted? Will the replication automatically copy it again? NOOOOOOO

Replication what we are seeing is ONE DIRECTIONAL. So, any changes to the source object will get replicated to the destination.

NOTE: There is BI-DIRECTIONAL replication as well.


Comments

Popular posts from this blog

SRE/DevOps Syllabus

AWS Code Commit - CI/CD Series Part 1

Docker - Preventing IP overlapping