Get started with Amazon S3 Cross-Region (CRR) and Same-Region (SRR) replication

Photo by Vipul Jha on Unsplash

Get started with Amazon S3 Cross-Region (CRR) and Same-Region (SRR) replication

Amazon S3 (Simple Storage Service) provides robust options for data replication, including Cross-Region Replication (CRR) and Same-Region Replication (SRR). Both are critical for different use cases in data management, backup, and disaster recovery.

  1. Cross-Region Replication (CRR):

    • Functionality: CRR allows you to automatically replicate data across different AWS regions. When you store an object in an S3 bucket, it can be automatically copied to a bucket in a different region.

    • Use Cases:

      • Geographical Compliance: For businesses that need to comply with data residency requirements, CRR enables them to store data in multiple regions as per legal or regulatory needs.

      • Disaster Recovery: CRR is crucial for disaster recovery plans. By replicating data in different geographical locations, you can protect your data against regional outages or disasters.

      • Latency Optimization: It can improve accessibility and reduce latency for end-users by placing data closer to them in different regions.

      • Data Localization: CRR helps in managing data localization laws by ensuring that data can be stored in multiple regions as required by local laws.

  2. Same-Region Replication (SRR):

    • Functionality: SRR, on the other hand, replicates data within the same AWS region but across different buckets.

    • Use Cases:

      • Operational Efficiency: For operational purposes like separating production data from test data within the same region.

      • Access Control: When you want different access controls or logging settings for your replicated data. For example, you could have a source bucket accessible by a wider group and a destination bucket with more restrictive access.

      • Data Aggregation: SRR is useful for aggregating logs or data from various accounts or services into a central repository within the same region.

      • Live Data Replication: In scenarios where you need a live replica of your data for immediate accessibility and redundancy.

You can also enable S3 Replication Time Control (S3 RTC) to help you meet compliance or business requirements for data replication. S3 RTC replicates most objects that you upload to Amazon S3 in seconds, and 99.99 percent of those objects within 15 minutes. To replicate existing objects, you can use S3 Batch Replication to backfill a newly created bucket with existing objects, retry objects that were previously unable to replicate, migrate data across accounts, or add new buckets to your data lake. For more information on S3 Replication, visit the Replicating Objects section in the Amazon S3 User Guide.

Both CRR and SRR are part of a broader strategy for managing data in the cloud, addressing different needs in terms of data accessibility, compliance, backup, and disaster recovery. They are flexible tools that can be configured according to specific business requirements and are integral to maintaining data integrity and availability in cloud-based environments.

Tutorial: Same-Region Replication by using AWS CLI

Setting up Same-Region Replication (SRR) for Amazon S3 via the AWS Command Line Interface (CLI) involves creating two S3 buckets within the same AWS region, enabling versioning on them, and configuring the replication rules. Here's a step-by-step guide:


  • AWS CLI: Ensure you have the AWS CLI installed and configured with an IAM user that has the necessary S3 permissions.

  • IAM Role: You need an IAM role that S3 can assume to perform replication. If you haven't already created one, follow the steps in the CRR tutorial to create an IAM role with the necessary permissions.

Creating an IAM Role for S3 Replication

  1. Create a Trust Policy File (trust-policy.json): This file allows the S3 service to assume the role.

       "Version": "2012-10-17",
       "Statement": [
           "Effect": "Allow",
           "Principal": {
             "Service": ""
           "Action": "sts:AssumeRole"
  2. Create the IAM Role: Use the AWS CLI to create a new role with the trust policy.

     aws iam create-role --role-name [role-name] --assume-role-policy-document file://trust-policy.json

    Replace [role-name] with your desired name for the role.

  3. Create a Permissions Policy File (permissions-policy.json): This policy allows the role to perform actions required for replication. For example:


    Replace [source-bucket-name] and [destination-bucket-name] with the names of your source and destination buckets.

  4. Attach the Permissions Policy to the Role:

     aws iam put-role-policy --role-name [role-name] --policy-name [policy-name] --policy-document file://permissions-policy.json

    Replace [role-name] and [policy-name] with the name of the role and a name for the policy.

After creating this IAM role with the necessary permissions, you can proceed with the rest of the SRR setup steps, ensuring you reference this role in the replication configuration.

Step 1: Create Source and Destination Buckets

  1. Create Source Bucket:

     aws s3 mb s3://[source-bucket-name] --region [your-region]

    Replace [source-bucket-name] with your desired bucket name and [your-region] with your AWS region code (e.g., us-east-1).

  2. Create Destination Bucket:

     aws s3 mb s3://[destination-bucket-name] --region [your-region]

    Replace [destination-bucket-name] with the name for the destination bucket. Ensure it is in the same region.

Step 2: Enable Versioning on Both Buckets

Versioning must be enabled on both the source and destination buckets.

  1. Enable Versioning on Source Bucket:

     aws s3api put-bucket-versioning --bucket [source-bucket-name] --versioning-configuration Status=Enabled

  2. Enable Versioning on Destination Bucket:

     aws s3api put-bucket-versioning --bucket [destination-bucket-name] --versioning-configuration Status=Enabled

Step 3: Set Up Replication on the Source Bucket

  1. Create a Replication Policy File (same-region-replication-policy.json): Create a JSON file (same-region-replication-policy.json) with the following content:

       "Role": "arn:aws:iam::[account-number]:role/[role-name]",
       "Rules": [
           "Status": "Enabled",
           "Priority": 1,
           "Destination": {
             "Bucket": "arn:aws:s3:::[destination-bucket-name]",
             "StorageClass": "STANDARD"
           "DeleteMarkerReplication": {
             "Status": "Disabled"
           "Filter": {}

    Replace [account-number], [role-name], and [destination-bucket-name] with your AWS account number, the IAM role name, and the destination bucket name.

  2. Apply the Replication Policy to the Source Bucket:

     aws s3api put-bucket-replication --bucket [source-bucket-name] --replication-configuration file://same-region-replication-policy.json

Step 4: Test the Replication

  1. Upload a File to the Source Bucket:

     aws s3 cp [file-to-upload] s3://[source-bucket-name]/

    Replace [file-to-upload] with the path to a local file.

  2. Verify Replication: After a short delay, check the destination bucket to see if the file has been replicated:

     aws s3 ls s3://[destination-bucket-name]/

This completes the setup for same-region replication using the AWS CLI. Remember to replace placeholders with your actual bucket names, region names, and file paths. Also, ensure that the IAM role and policies are correctly configured to allow the necessary permissions for replication.


  1. Replicating objects

  2. Setting up permissions

  3. Replicate Data within and between AWS Regions Using Amazon S3 Replication

  4. Amazon S3 Replication

  5. Managing delete marker replication in Amazon S3