Ravindra BagaleCourses & study guides

15. Amazon RDS for MySQL: Create, Connect, Back Up and Keep It Private

15.5 Automated Backups, Snapshots and Restore

Backup nahi tar database nahi – asa samja. RDS don prakarache backups deto:

Type How Kept until Use
Automated backups Daily snapshot + transaction logs, automatic Retention period (1–35 days) Point-in-time restore to any second in the window
Manual snapshots You click Take snapshot or run CLI You delete them Before upgrades, big changes, or to copy to another region/account
aws rds create-db-snapshot --db-instance-identifier reels-db --db-snapshot-identifier reels-db-before-v2
aws rds describe-db-snapshots --db-instance-identifier reels-db --query "DBSnapshots[].[DBSnapshotIdentifier,Status]"
# point-in-time restore ALWAYS creates a NEW instance
aws rds restore-db-instance-to-point-in-time --source-db-instance-identifier reels-db \
  --target-db-instance-identifier reels-db-restored --restore-time 2026-09-27T04:30:00Z \
  --db-subnet-group-name reels-db-subnets --vpc-security-group-ids sg-0db11111 --no-publicly-accessible

Restore never overwrites the original. You get a new instance with a new endpoint; test it, then point the app to it (or copy the rows you need back). Logical backups with mysqldump from EC2 still work and are handy for moving data:

mysqldump -h <endpoint> -u admin -p --single-transaction reelsdb > reelsdb.sql

Why this matters for security

Backups are your last line of defence against ransomware and destructive attacks. Encrypted snapshots stay encrypted; share snapshots only with accounts you trust and never mark one public – public RDS snapshots can be copied by any AWS account.

Ravindra Bagale's Tip

Students restore and wait for the old database to change – but a restore always creates a new instance with a new endpoint! Change the endpoint in the app config, or copy the data back. And when deleting an instance, never skip the "final snapshot" option.

Practice task

Take a manual snapshot, insert a test row, then do a point-in-time restore to a time before the insert. Connect to the restored instance and prove the row is missing. Delete the restored instance afterwards.