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.
Ravindra Bagale's Tip – मराठी
Students restore करून वाट बघत राहतात की जुना database बदलेल – पण restore नेहमी नवीन instance बनवतो, नवीन endpoint सोबत! App config मध्ये endpoint बदला किंवा data परत copy करा. आणि instance delete करताना "final snapshot" चा option कधी skip करू नका.
Ravindra Bagale's Tip – हिंदी
Students restore करके इंतज़ार करते रहते हैं कि पुराना database बदलेगा – पर restore हमेशा नया instance बनाता है, नए endpoint के साथ! App config में endpoint बदलो या data वापस copy करो. और instance delete करते समय "final snapshot" का option कभी skip मत करना.
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.