How to Enable Cross Region Replication for Amazon S3
In this blog, I will explore how to enable cross region replication in different AWS regions. One is Tokyo and one is in Ohio region. Replication copies recently created objects & object updates from a source bucket to a destination bucket. Replication is the automated, nonsynchronous copying of objects crosses buckets in the different or same AWS Regions. For more details about S3 buckets replication concepts and how to utilize replication with the AWS CLI, AWS SDKs.
Enable Cross Region Replication
Create an S3 Bucket (Tokyo region)
1- Login to your AWS Management Console, select services, and then select S3 under storage.
2- Click the Create Bucket button.
3- Enter a Bucket name (tokyobucket22) and then select Region.
4- Uptick Block all public access checkbox.
5- Bucket versioning select enable.
6- Under advanced settings Object Lock section. If you want to lock object then you can select the enable option and then click create bucket.
The AWS S3 bucket (Tokyo region) has been created successfully.
Create an S3 Bucket (Ohio region)
1- Click on the create bucket to create a bucket in other region (Ohio).
2- Bucket name (ohiobucket222), select region (Ohio).
3- Uptick Block all public access checkbox.
4- Bucket Versioning select enable.
5- Advanced settings, under object lock select (enable/disable) and then click create bucket.
6- Buckets has been created successfully (1 in Tokyo and 1 in Ohio Region).
Adding Replication Rule
Add replication rule when the destination S3 bucket is in a different AWS account
1- In the Bucket name list, select the name of the bucket (tokyobucket22) that you want.
2- Select Management
3- Select Replication, and then select Add rule.
4- In the Replication rule wizard, under Set source page, entire bucket, and then click Save.
5- In the Set destination page, under Destination bucket.
Under storage, class select standard and then click next.
6- In the configure rule option, select Create a new role under IAM rule.
Under rule name type a rule name (Rep-Tokyo-Ohio).
Select enable under status and then click next.
7- Review your replication rule and then click save.
8- Replication configuration updated successfully.
How to upload files/folders to an S3 Bucket
This guide will explains how to upload files into an S3 bucket.
To upload files to an S3 bucket
1- Select your S3 bucket (tokyobucket22) the name of the bucket that you want to upload your files to.
2- Select Upload.
3- In the Upload dialog box, select Add files.
4- Select files to upload, and then select Open.
5- Click next.
6- Click on next button, to set permissions or properties for the files that you are uploading.
7- Select storage class and then click next.
8- Select upload
9- One text file is successfully uploaded to our (tokyobucket22) bucket, click Amazon S3.
10- Select other region bucket (ohiobucket222).
11- Now you can see our text file.
To upload files to an S3 bucket other region
1- Select your S3 bucket (ohiobucket222) the name of the bucket that you want to upload your files to. Select Upload.
2- In the Upload dialog box, select Add files.
3- Select files to upload, and then select Open. Click next.
4- Select next, to “Set permissions or properties” for the files that you are uploading, choose next.
5- Select storage class and then click next.
6- Select upload.
7- One text file is successfully uploaded to our (ohiobucket222) bucket, click Amazon S3.
8- Select the bucket (tokyobucket22), to check the files is uploaded on other bucket.
9- Now you can’t see the files on (tokyobuket22) bucket.