DynamoDB Backup and Restore
DynamoDB provides two backup mechanisms to protect your data against accidental deletion, corruption, or data loss. Understanding both options helps you choose the right protection level for your tables.
Why Backups Matter
Even though DynamoDB stores data across multiple nodes for availability, none of that redundancy protects you from accidental data deletion. If your application deletes an item — or an entire table — the deletion is replicated to all nodes immediately. Backups are the only way to recover from such mistakes.
Backup Option 1: On-Demand Backup
An on-demand backup creates a full, consistent snapshot of your table at a specific point in time. You trigger it manually — whenever you want. You might create one before a major application deployment, before a risky data migration, or on a weekly schedule.
Key Characteristics
- Zero performance impact on the table — no slowdowns during backup creation
- Backup completes in seconds regardless of table size
- Backups persist until you explicitly delete them — no automatic expiry
- You pay for the storage used by the backup
Creating a Backup
AWS CLI: aws dynamodb create-backup \ --table-name Orders \ --backup-name "Orders-BeforeMigration-2024-06-01" Result: BackupArn: arn:aws:dynamodb:ap-south-1:123456:table/Orders/backup/... BackupStatus: AVAILABLE BackupCreationDateTime: 2024-06-01T10:00:00Z
Restoring from a Backup
Restoring from an on-demand backup creates a new table. You cannot restore directly into the existing table — the restored data always goes into a new table name. After restoration, you can rename or redirect your application to the new table.
aws dynamodb restore-table-from-backup \ --target-table-name Orders-Restored \ --backup-arn arn:aws:dynamodb:... The restored table is a full, independent table — not linked to the original. Restoration time: minutes to hours depending on table size.
Backup Option 2: Point-in-Time Recovery (PITR)
Point-in-Time Recovery gives you a continuous, rolling backup of your table for the last 35 days. You can restore your table to any second within that 35-day window. PITR protects against gradual data corruption or accidental writes that you may not notice for hours or days.
The PITR Analogy
Think of PITR as a time machine for your table. On-demand backup gives you a photograph taken at one moment. PITR gives you a continuous video recording of the past 35 days. You can rewind to any frame.
Enabling PITR
PITR is OFF by default. Enable it per table: AWS Console: Table → Backups → Enable PITR AWS CLI: aws dynamodb update-continuous-backups \ --table-name Orders \ --point-in-time-recovery-specification PointInTimeRecoveryEnabled=true
Restoring to a Point in Time
Scenario: Someone deleted all "Cancelled" orders at 2024-06-05 14:30 UTC Solution: Restore table to 2024-06-05 14:29 UTC (one minute before the error) aws dynamodb restore-table-to-point-in-time \ --source-table-name Orders \ --target-table-name Orders-Recovery \ --restore-date-time 2024-06-05T14:29:00Z Result: New table Orders-Recovery contains data as it was at 14:29 UTC
Like on-demand restore, PITR always restores to a new table name. It does not overwrite the existing table.
Side-by-Side Comparison
| Feature | On-Demand Backup | Point-in-Time Recovery |
|---|---|---|
| Trigger | Manual (or scheduled) | Automatic, continuous |
| Restore granularity | Specific backup timestamp | Any second in last 35 days |
| Backup retention | Until you delete it | 35-day rolling window |
| Data older than 35 days | Accessible if you kept the backup | Not accessible via PITR |
| Storage cost | Per GB stored | Per GB of change data |
| Best for | Planned snapshots before changes | Protection from ongoing accidents |
What Gets Restored
A restored table includes all items and the table's GSIs. However, the following are NOT automatically restored:
- Auto Scaling settings
- IAM policies attached to the table
- CloudWatch alarms
- TTL settings
- DynamoDB Streams configuration
- Tags
You must reconfigure these settings manually after restoration.
AWS Backup Integration
Both backup types integrate with AWS Backup — a centralized backup management service. AWS Backup lets you apply a unified backup policy across multiple services (DynamoDB, RDS, S3, EFS) from one place. For organizations with compliance requirements (healthcare, finance), AWS Backup provides automated scheduling, retention policies, and audit reports.
Backup Costs
- On-Demand Backups: Charged per GB of backup storage per month. The backup captures only the used storage, not the full provisioned space.
- PITR: Charged per GB of table data protected per month. The cost is typically a small fraction of your table storage cost.
- Restoration: Free. You only pay for the storage of the new restored table once it exists.
Best Practices
- Enable PITR on all production tables — the cost is low relative to the data recovery value.
- Create on-demand backups before every major schema change, migration, or application deployment.
- Store on-demand backups with descriptive names including the date and reason (e.g.,
Orders-Pre-Migration-2024-06-01). - Periodically test your restore process — do not wait for a real disaster to discover a problem.
- Use AWS Backup for centralized backup governance across your entire AWS infrastructure.
