Backup, Point-in-Time Recovery, and Exports
Mistakes happen: a migration overwrites attributes, a bug deletes items, an engineer runs the wrong script.
Introduction
Mistakes happen: a migration overwrites attributes, a bug deletes items, an engineer runs the wrong script. DynamoDB offers point-in-time recovery (PITR), on-demand backups, and exports to S3, none of which affect table performance. Knowing exactly what a restore does — and does not — bring back is part of every production runbook.
Purpose of this lesson
You will enable PITR, take an on-demand backup, restore to a point in time, and export a table to S3 for analytics.
Understanding the topic
Options:
- PITR: continuous backups; restore to any second within the recovery period (up to 35 days).
- On-demand backups: full backups kept until you delete them — take one before risky migrations.
- AWS Backup: central schedules, retention, cross-account and cross-Region copies.
- Restores always create a new table. Auto scaling policies, IAM policies, CloudWatch alarms, tags, stream settings, TTL settings, and PITR settings are not restored — reapply them.
- Export to S3 (requires PITR) writes DynamoDB JSON or Ion files without consuming table capacity; incremental exports capture changes over a window.
Step-by-step explanation
- Identify the incident window from logs or CloudTrail.
- Restore PITR to a new table at a time just before the incident.
- Re-enable streams, TTL, alarms, auto scaling, and tags on the restored table as needed.
- Compare restored and current data; copy back only the affected items (or switch traffic to the restored table).
- Write up the gap between restore time and switch-over, and how writes during that gap were handled.
Syntax reference
Runbook commands:
# Enable PITRaws dynamodb update-continuous-backups --table-name ShopTable \--point-in-time-recovery-specification PointInTimeRecoveryEnabled=true# Before a migrationaws dynamodb create-backup --table-name ShopTable --backup-name shoptable-pre-migration-2026-11-19# Restore to just before an incidentaws dynamodb restore-table-to-point-in-time \--source-table-name ShopTable \--target-table-name ShopTable-restore-0955 \--restore-date-time 2026-11-19T09:55:00Z# Export for analytics (no table capacity consumed)aws dynamodb export-table-to-point-in-time \--table-arn arn:aws:dynamodb:us-east-1:123456789012:table/ShopTable \--s3-bucket shop-analytics-exports --export-format DYNAMODB_JSON
Best practices
- Enable PITR and deletion protection on every production table.
- Take a named on-demand backup before every data migration.
- Rehearse restores regularly and time them — restore time grows with table size.
- Keep restore runbooks in infrastructure-as-code so settings are reapplied automatically.
Common mistakes
- Assuming a restore overwrites the existing table.
- Forgetting to re-enable streams, so downstream consumers silently stop.
- Using Scan-based scripts for analytics exports instead of Export to S3.
Advanced interview questions
Interview Prep
Practice concise answers, then expand each card for the explanation.
1IntermediateQuestionWhat does a DynamoDB restore not bring back?+
Answer
2BeginnerQuestionHow would you run analytics on DynamoDB data?+
Answer
Hands-on exercise
Hands-on (sandbox account): enable PITR, write ten items, note the time, delete three items, then restore to the noted time into a new table. Write a script that copies only the three missing items back to the original table.
Summary
PITR, on-demand backups, AWS Backup, and S3 exports cover recovery and analytics. Restores create new tables without several settings, so runbooks must reapply them.