AWS S3 Bucket Replication

Mayank Patel
3 min readAug 15, 2020

--

If you are backing up your data to S3 bucket and looking to replicate to be extra cautious then you have found an appropriate post. In this post, we will be covering high-level s3 replication options and use cases. Also, focus on the same region replication using complete Terraform source code. Complete Source code can be found here.

Replication Options

Same Region Replication (SRR) is used to copy objects across Amazon S3 buckets in the same AWS Region.

Use of SRR

  • Aggregate logs into a single bucket
  • Configure live replication between production and test accounts
  • Abide by data sovereignty laws

Cross-Region Replication (CRR) is used to copy objects across Amazon S3 buckets in different AWS Regions.

Use of CRR

  • Meet compliance requirements
  • Minimize latency
  • Increase operational efficiency

How Replication works

**NOTE — Replication requirements

* Versioning on source and destination bucket must be enabled

* Object Locking must not be enabled

Steps to setup replication using Terraform

Setup IAM Role to enable Replication

  • Create an IAM Role to enable S3 Replication,
  • Create an IAM Policy
  • Attach the policy to Role.

Setup Destination Bucket (replicate data to)

  • Create Destination Bucket with bucket policy
  • Enable Versioning

Setup Source Bucket (replicate data from)

  • Create Source Bucket
  • Enable Versioning

Feel free to make a contribution. Make sure to follow best practices for your deployment.

I hope this post has helped you. If you enjoyed this article, please don’t forget to clap 👏, comment, and share! I would love to know what you think and would appreciate your thoughts on this topic. You can also follow me on Medium, GitHub, and Twitter for more updates.

--

--