Backups & Disaster Recovery

Automated backups and a tested recovery plan protect you from data loss and outages.

Deployments protect your code; backups protect your data. Assume any single resource can fail and plan how to recover.

What to back up

  • Databases — enable automated RDS snapshots and point-in-time recovery.
  • Object data — turn on S3 versioning and cross-region replication for critical buckets.
  • Config & infra — your IaC in Git is the backup of your infrastructure.

Two numbers to define

  • RPO (Recovery Point Objective) — how much data you can afford to lose.
  • RTO (Recovery Time Objective) — how fast you must be back online.

Use AWS Backup to centralize and schedule backups, and actually test a restore — an untested backup is only a hope.

Example

Example · bash
# Take an on-demand RDS snapshot before a risky change
aws rds create-db-snapshot \
  --db-instance-identifier myapp-prod \
  --db-snapshot-identifier myapp-prod-pre-migration-2026-07-15

# Enable versioning so deleted/overwritten S3 objects are recoverable
aws s3api put-bucket-versioning \
  --bucket myapp-prod-uploads \
  --versioning-configuration Status=Enabled

When to use it

  • A team enables automated RDS snapshots with a 7-day retention period so they can restore the database to any point in the past week after a bad migration.
  • An ops engineer tests the restore procedure monthly by launching a new RDS instance from a snapshot to verify the backup is actually usable.
  • A company uses AWS Backup to apply a unified backup plan across RDS, EFS, and DynamoDB tables so no data store is accidentally left uncovered.

More examples

Enable automated RDS backups

Sets a 7-day backup retention window and schedules daily snapshots at 3am UTC when traffic is lowest.

Example · bash
aws rds modify-db-instance \
  --db-instance-identifier my-db \
  --backup-retention-period 7 \
  --preferred-backup-window '03:00-04:00' \
  --apply-immediately

Create an on-demand RDS snapshot

Creates a manual snapshot before a risky migration and waits for it to complete so you have a guaranteed restore point.

Example · bash
aws rds create-db-snapshot \
  --db-instance-identifier my-db \
  --db-snapshot-identifier pre-migration-$(date +%Y%m%d)

aws rds wait db-snapshot-available \
  --db-snapshot-identifier pre-migration-$(date +%Y%m%d)
echo 'Snapshot ready'

Create AWS Backup plan for RDS

Creates an AWS Backup plan that backs up RDS daily at 3am and retains backups for 30 days automatically.

Example · bash
aws backup create-backup-plan \
  --backup-plan '{
    "BackupPlanName": "daily-rds",
    "Rules": [{
      "RuleName": "daily",
      "TargetBackupVaultName": "Default",
      "ScheduleExpression": "cron(0 3 * * ? *)",
      "DeleteAfterDays": 30
    }]
  }'

Discussion

  • Be the first to comment on this lesson.
Backups & Disaster Recovery — AWS Deployment | SoundsCode