How to configure cross region replication

How to configure cross region replication 

Follow the steps to configure a Cross-region replication when the source and destination bucket is in the same AWS account, with an example.

1. Sign in to the AWS Console and open the Amazon S3

2. Create Two Buckets
   2.1 Source bucket in Asia Pacific (ap-south-1): cloudiofy-user-data
   2.2 Destination bucket in US East (us-east-1): cloudiofy-user-data- backup

 
2.3 Add a user (user-1.json) sample file in the source bucket before setting replication rule.


3. Enable versioning for source and destination bucket.
For example to enable versioning for source bucket(repeat same for destination bucket), Go to bucket Properties, Select Versioning, Select Enable versioning and then Save.


4. Open Source bucket (cloudiofy-user-data ), go to Management, select Replication, and then click on the Add rule

   
5.  In the replication rule wizard, under Set source, you can select option:

  • To replicate the whole bucket, select entire bucket.
  • To replicate all objects that have the same prefix, add your Prefix or tags.


  5.1  Let’s proceed with entire bucket option, then click on the Next


 5.2 Under Set destination, select your destination bucket i.e. cloudiofy-user-data-backup

 
 5.3 Under configure rule options, Set up an IAM role to replicate objects on your behalf. Add role name: cloudiofy-cross-region-replication-role and click on the Next.


  5.4 Under review verify your configuration settings and click on the Save. After saving, a screen is visible with a success message.

Note: Created IAM policy looks like:

{
    "Version": "2008-10-17",
    "Id": "S3-Console-Replication-Policy",
    "Statement": [
        {
            "Sid": "S3ReplicationPolicyStmt1",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::0000000000:root"
            },
            "Action": [
                "s3:GetBucketVersioning",
                "s3:PutBucketVersioning",
                "s3:ReplicateObject",
                "s3:ReplicateDelete"
            ],
            "Resource": [
                "arn:aws:s3:::cloudiofy-user-data-backup",
                "arn:aws:s3:::cloudiofy-user-data-backup/*"
            ]
        }
    ]
}


6. Now, Let’s check whether replication works.
Add two new users (user-2.json, user-3.json) in source bucket (cloudiofy-user-data) that must be copied to the destination bucket(cloudiofy-user-data-backup) automatically.

6.1 Source bucket (cloudiofy-user-data)


6.2 Destination bucket(cloudiofy-user-data-backup)

Note: User file (user-1.json) was not replicated to destination bucket because the file (user-1.json) was uploaded to source bucket before setting replication rule.

How to configure cross region replication
Scroll to top