Sub topic 8
Backups, Snapshots, and Point-in-Time Restore
This chapter assumes you can provision an RDS instance and use the AWS CLI. RDS gives you two kinds of backups, and both restore into a new instance. Knowing how they differ helps you choose a retention period and plan a recovery.
Automated backups and snapshots
RDS takes a daily storage-volume snapshot during your backup window. It also uploads transaction logs to Amazon S3 about every five minutes. Together, these let you restore to any second inside the retention period. This is point-in-time restore (PITR).
| Feature | Automated backups | Manual snapshots |
|---|---|---|
| Created by | RDS, on a schedule | You, on demand |
| Retention | 0 to 35 days | Until you delete them |
| Point-in-time restore | Yes | No, restores to the snapshot moment only |
| Deleted with the instance | Yes, unless you keep them | No |
The --backup-retention-period 7 flag in the provisioning command turns on seven days of automated backups. A value of 0 disables them. That also disables PITR, and it prevents the instance from acting as a source for read replicas on most engines.
How a restore works
A restore never overwrites the source. RDS always creates a new instance with a new endpoint. You then repoint your application or swap names.
Restoring to a point in time
This command restores the latest restorable time into a new instance and leaves the original untouched.
aws rds restore-db-instance-to-point-in-time \
--source-db-instance-identifier demo-pg \
--target-db-instance-identifier demo-pg-restored \
--use-latest-restorable-timeTo pick an earlier moment, replace --use-latest-restorable-time with --restore-time 2026-11-26T17:30:00Z. The time must fall inside the retention period and before the latest restorable time.
A restored instance does not inherit everything from the source. Check these settings and set them again if needed:
- The security groups and the parameter group. You can pass them on the restore command.
- Read replicas. They are not restored.
- Whether the instance is Multi-AZ. Specify it explicitly if you need it.
Taking a manual snapshot
Take a manual snapshot before risky changes such as a major version upgrade. It stays until you delete it, so it also suits long-term archives.
aws rds create-db-snapshot \
--db-instance-identifier demo-pg \
--db-snapshot-identifier demo-pg-before-upgrade
aws rds restore-db-instance-from-db-snapshot \
--db-instance-identifier demo-pg-from-snap \
--db-snapshot-identifier demo-pg-before-upgradeCommon errors and gotchas
- Backups vanish with the instance. Deleting an instance removes its automated backups unless you choose to retain them. Always take a final snapshot for data you care about.
- The backup window can cause latency. On a Single-AZ instance, I/O can be briefly suspended at the start of the snapshot. Multi-AZ takes the snapshot from the standby, so the primary is not affected.
- Restore time is not instant. Time grows with data size and with the amount of log to replay. Test a restore before you need one.
- Restored instances cost money. Delete test restores when you finish, as shown in the cleanup chapter.
Exercise
A developer ran a bad DELETE at 17:42 UTC. Automated backups are on with seven days of retention. How do you recover the rows, and what happens to the original instance?
Show answer
Run restore-db-instance-to-point-in-time with --restore-time set to just before 17:42 UTC and a new target identifier. RDS creates a new instance. The original keeps running unchanged. Connect to the restored instance, copy the missing rows back into the original, then delete the restored instance to stop its cost.