Problem Statement:
A leading online travel platform, relies heavily on delivering high-quality images of holiday destinations, hotels, and packages to its users. These images are currently stored in an Amazon S3 bucket located in the North Virginia region. However, users accessing the site from regions far from North Virginia, particularly from Asia-Pacific areas, are experiencing significant latency issues. This latency negatively impacts the user experience, as images load slowly, leading to potential customer dissatisfaction and reduced engagement on the platform.
Solution:
To address this latency issue, the management at Travel Triangle decided to implement Amazon S3 Cross-Region Replication (CRR). By replicating the images from the North Virginia S3 bucket to a new S3 bucket in the Mumbai region, users in the Asia-Pacific region will experience faster load times, as the images will be served from a geographically closer location.
The replication setup ensures that any new images uploaded to the North Virginia bucket are automatically replicated to the Mumbai bucket. This solution not only improves the user experience by reducing latency but also provides an additional layer of data redundancy, enhancing the overall availability and resilience of the application.
By implementing S3 Cross-Region Replication, Travel Triangle can now offer a seamless and faster browsing experience to its global user base, thereby maintaining its competitive edge in the travel industry.
Introduction
What’s Cross-Region Replication (CRR) ?
- Cross-Region Replication allows you to automatically replicate data from one S3 bucket to another in a different AWS region. This helps in achieving compliance requirements, minimizing latency for geographically dispersed users, and enhancing disaster recovery capabilities.
- With CRR, you can replicate the entire bucket or just specific objects, and you have control over which objects get replicated.
- Replication is asynchronous, meaning changes to the source bucket are eventually replicated to the destination bucket. However, it’s important to note that replication does not retroactively replicate objects already in the source bucket before replication was enabled.
- You can use CRR to maintain redundant copies of your data in different geographic locations, improving data durability and availability.
What’s Versioning ?
- Versioning in S3 allows you to keep multiple variants of an object in the same bucket and it is essential for CRR in both buckets. Each time you overwrite an object or delete it, a new version is created, which you can retrieve later if needed.
- Versioning helps protect against accidental deletion or overwriting of objects. Even if an object is deleted or overwritten, previous versions remain accessible.
- By enabling versioning, you can create a reliable versioned backup system within a single bucket, without the need for additional replication or backup solutions.
- It’s important to note that versioning does not protect against all types of data loss scenarios, such as the accidental deletion of an entire bucket with versioning disabled.
Architecture Diagram
Task Steps
Step 1: Sign in to AWS Management Console
- On the AWS sign-in page ,enter your credentials to log in to your AWS account and click on the Sign in button.
- Once Signed In to the AWS Management Console, Make the default AWS Region as US East (N. Virginia) us-east-1
- Navigate to the Services menu at the top. Click on S3 in the Storage section.
Step 2: Source Bucket
This is the source bucket ” tt-stage-docs ” along with the path “attachments/ pictures/ ” in which images get uploaded . Create the appropriate bucket policy in order to provide required permissions for CRR.
Step 3: Target Bucket
This is the destination bucket ” tt-stage-json-apis ” in which we want to replicate images from source bucket as described above. Here we need to create appropriate bucket policy in order to provide required permissions for CRR.
Step 4: Enable Replication in Source Bucket and add a rule
In this step, we are going to create a replication rule for the source bucket and will specify the destination bucket.
- Now go to Source Bucket and click on Management. Scroll down and select Create replication rule button.
- Enter a rule name of your choice and keep the status as Enabled.
- Choose the source bucket & a rule scope : Select Limit the scope of this rule using one or more filters since we want to replicate all the images uploaded in the given folder path as ” attachments/pictures/”
- Under Destination, select choose a bucket in this account and click on Browse S3.
- Select the target bucket ” tt-stage-json-apis “ and click on Choose path button.
- Under IAM Role, select Create new role and add essential permission & policy as shown below.
-
Under the Destination Storage Class, select Change the storage class for the replicated objects and choose Standard
Note :
- AWS S3 provides the ability to specify a replication time control (RTC) for cross-region replication.
- RTC allows you to define a service level agreement (SLA) for object replication, specifying the maximum time it should take for an object to be replicated to the destination bucket.
- This feature helps you ensure timely replication and maintain data consistency across regions.
- Delete marker replication allows if we delete an image from source bucket then it will automatically gets deleted from destination bucket too.
- Now navigate to the source bucket and upload an Object(1106816) in the Source bucket by clicking on Add Files. Click on Upload.
- Navigate to your Target Bucket to see the replication. It may take up to 3–5 minutes for replication.
Now we have successfully configured the Cross-Region Replication in S3 Bucket.
You’re all done! Congratulations!
That’s all I have for today folks. Thank you for reading and/or following along! I hope this project was helpful and worth your while. Stay tuned for my next project on this journey into the cloud.