Amazon S3: Cross-Region Replication

Amazon S3: Cross-Region Replication

This Blog is about Amazon S3 cross-region replication as a managed service available in AWS. With this Service, We can take our data and workloads global and maintain version control of our s3 objects.

Reasons why we may need to copy our data to reside in more than one AWS region

  1. Business Requirement or Compliance Reasons
  2. Disaster Recovery Policy and in need to enhance the durability of Data
  3. Need Second Copy in different S3 Storage Class / AWS Account / AWS Region for availability / latency or optimization reasons.
    We can achieve all of the above objectives and more with S3 cross-region replication.

Key points for S3 Cross Region Replication

  • When an object is replicated into another AWS region by default, all of the objects, metadata, access control lists and object tags are also replicated and any further changes made to the source objects, metadata, access control list, or object tags also trigger replication to the destination.
  • We can choose to replicate entire Buckets OR Objects under a shared prefix only OR at the object level using certain object tags only replication.
  • Additionally, We have added controls to change the ownership of the replicated object to a different AWS account to protect against accidental or malicious actions if the source account is compromised.
  • In 2020, AWS introduce, S3 Replication (multi-destination) : It is intended for customers that want to create and maintain multiple copies of their data in one or more AWS Regions. Amazon S3 Replication now gives usthe ability to replicate data from one source bucket to multiple destination buckets in the same, or different AWS Regions.
  • We can also configure S3 to store replicated data in any S3 storage class including S3 glacier irrespective of the storage class of the source objects to meet compliance requirements.
  • Versioning must be enabled on both the source and destination bucket.

How S3 replication works


How to set up S3 Bucket Replication and It's Options

  1. Creating Two Buckets in S3
    Source Region Bucket : s3replicationsource-us-east-1
    Target Region Bucket : s3replicationtarget-us-west-1

image.png image.png

  1. Create a Bucket Replication Rule
    Screenshot 2022-10-04 110535.jpg

Replication Rule Options :

  • Choose the replication rule status to enable and the name of the replication rule. image.png
  • Scope to Filter by Prefix , Tag or All Objects to replicate in Source Bucket. image.png
  • Choose Destination Bucket. Option of Same Account or Different Account. I choose my previously created us-west-1 bucket in the same account.
  • Create new IAM Role or use existing S3 Required permissions enabled IAM Role. image.png
  • Choose if We want to enable "Encryption" on replication
  • We can Choose the Destination Bucket Storage Class
    More on S3 Storage Classes image.png
  • Choose Appropriate Additional Option and Save
    Options are for notification, monitoring, delete marker replication and modification sync related. image.png
  • One Time Popup Option to "Replicate Existing Objects" as a batch job when We save the Replication Rule.
  • Our Replication Rule and Created and in Enabled State

From this point forward, any objects added to my Source bucket (s3replicationsource-us-east-1) will be replicated to my Destination Bucket (s3replicationtarget-us-west-1).
And Not only that, Any modification, edit , overwrite, delete will be replication to destination bucket as well.

Test :
Object "1.jpg" i uploaded to my Source Bucket (us-east-1) in Standard Storage Class is automatically Replicated to my Destination Bucket(us-west-1) in One-Zone Storage Class.

Source Bucket
image.png Destination Bucket

Delete Operations on Objects in Source Bucket is also replicated.

Additionally, Amazon S3 can publish replication events as in Event Notification.
Amazon S3 sends event notifications when an object fails replication, exceeds the 15-minute threshold, replicates after the 15-minute threshold, and misses tracking by replication metrics.

In Source S3 Bucket Properties > Select Event Notification > Create Event Name and Type : Replication Event and Desitnation to SNS Topic image.png image.png image.png

In this Blog, I showed how Amazon S3 replication is an easy, fully managed, a customizable and low-cost feature that replicates objects between buckets in Cross-Region (CRR) or Same-Region(SRR) Replication within same AWS Account or Separate AWS Account.
Anyone can use this solution to build a data redundancy capability to meet regulatory compliance, business continuity, and disaster recovery requirements.

Thank you for reading and following along with the Blog.

Happy Learning.

Like and Follow for more Azure and AWS Content.

Jineshkumar Patel