π RDS Snapshot Replication Across AWS Regions
π§ Inspiration
In real-world applications, ensuring disaster recovery and high availability across regions is a top priority. I wanted to explore how Amazon RDS Snapshots can be used to replicate database state across AWS regions, and how to do it completely using CLI and infrastructure best practices.
π What I Built
I built a working solution that:
- Creates a manual snapshot of a running RDS MySQL instance
- Copies that snapshot securely to another AWS region using CLI
- Restores the snapshot as a brand-new RDS instance in the target region
- Configures EC2 to securely connect to the restored DB instance for verification
This project mimics real-world cross-region disaster recovery, entirely using AWS CLI and IAM best practices.
π§© How It Works
- β
RDS Snapshot: I initiated a manual snapshot of my running MySQL database in
eu-west-1
. - π Cross-Region Copy: I securely copied the snapshot to
us-east-1
, providing the right KMS key and permissions. - π Restoration: The snapshot was restored as a new database in the destination region.
- π Security Group Linking: I configured the database's SG to only allow port 3306 from my EC2 instance β a critical security and connectivity setup.
- π Testing: I used EC2 to connect to the new database using MySQL CLI and verified everything worked.
π Challenges I Faced
- β Cross-region encryption: Required specifying a new KMS key.
- β IAM Denial: A Service Control Policy (SCP) was explicitly denying the snapshot copy action.
- β οΈ Connectivity issues: Even with "All traffic" allowed, the DB was unreachable until I restricted access only to port 3306.
- π Understanding SSH & IAM policies: Took time to troubleshoot security-related errors cleanly.
β What I Learned
- How RDS snapshots and cross-region copy logic works in detail
- How to set up secure security groups for EC2-to-RDS communication
- How to debug common AWS CLI and IAM permission errors
- Importance of precise permissions over broad βAllow allβ settings
π» Tech Stack
- Amazon RDS (MySQL)
- AWS CLI
- EC2 (Ubuntu)
- IAM, KMS, VPC, SG
- Linux terminal & MySQL client
π What's Next?
- π§ Automate the snapshot + copy process using AWS Lambda
- π§ͺ Add a backup validation pipeline for real-world DR simulation
- π¦ Set up CloudWatch Alarms to monitor cross-region syncs
Top comments (0)