Overview:
In this article, I’ll walk through how to create an Amazon RDS instance, insert sample data, take a backup, and perform a restore. This is a beginner-friendly guide with screenshots, perfect for anyone learning AWS RDS high availability and disaster recovery basics.
Introduction:
Databases are the heart of most applications, and ensuring data safety is critical. Amazon RDS (Relational Database Service) takes away the heavy lifting of database management, including backups and restores. In this guide, I’ll demonstrate how to back up a database instance and restore it to recover lost data.
Core Concepts:
Amazon RDS → This is a managed service for relational databases.
Backup Types in RDS:
Automated Backups (point-in-time recovery)
Manual Snapshots (user-initiated, stored until deleted)
Restore Behavior: restores always create a new DB instance, not overwrite the existing one.
Phase A – Create an RDS Instance
Go to AWS Console → RDS → Create database.
Choose:
Engine: PostgreSQL (or MySQL if you prefer).
Deployment option: Single-AZ (we’ll switch to Multi-AZ later).
DB instance class: db.t3.micro (cheap/free tier).
Storage: 20 GiB, gp3.
Credentials: set username/password.
Networking: default VPC, allow public access (for lab only), create a security group allowing inbound 5432 (Postgres) or 3306 (MySQL) from your IP.
Backups: enable automated backups (7 days).
Monitoring: leave defaults.
Click Create database.
Verify endpoint:
aws rds describe-db-instances \
--db-instance-identifier lab-rds \
--query 'DBInstances[0].Endpoint.Address'
Phase B – Connect and Install Sample Data
Connect from CloudShell or your PC:
psql "host=<your-endpoint> dbname=postgres user=labuser password=StrongPassw0rd!"
Insert Sample Data - Create table + data: + Confirm data entered
INSERT INTO users (name, email) VALUES
('prince', prince@example.com),
('Kingson', kingson@example.com),
SELECT * FROM users;
Phase 3: Backup & Restore
Manual Snapshot
**Console: RDS → Databases → Select your DB → Actions → Take snapshot → name it.
CLI:**
aws rds create-db-snapshot \
--db-snapshot-identifier lab-snap1 \
--db-instance-identifier lab-rds
Simulate Data Loss: and confirm if data was deleted
`DELETE FROM orders WHERE id=1;`
SELECT * FROM users;
Phase 4: Restore from Snapshot
Console: RDS → Snapshots → Select → Restore snapshot → new instance.
CLI:
aws rds restore-db-instance-from-db-snapshot \
--db-instance-identifier lab-restore1 \
--db-snapshot-identifier lab-snap1
Verify Restored DB: Get endpoint of new DB.
Connect and run:
SELECT * FROM orders;
The deleted row should be back
Observations & Learnings
Multi-AZ is for high availability, not backups.
A restored DB has a different endpoint.
Applications need to be re-pointed to the new DB if you restore.
Point-in-time restores do not overwrite; they create a new DB.
Conclusion:
This lab demonstrated the importance of backups in RDS and how easy AWS makes it to restore a database instance. Backups are crucial for disaster recovery, and practicing these steps ensures that you’ll know how to protect and recover your data when it matters most.
If you’re practicing AWS RDS, I recommend extending this lab by testing a point-in-time recovery. This will give you more confidence in handling real-world scenarios.
Top comments (0)