DynamoDB Backup, PITR, Export, Import and Restore
Backups are useless until you restore. Casablanca SRE Fatima Zahra and Berlin bank lead Lucas Meyer said: PITR was on, nobody had restored in 18 months — first drill failed IAM. On-demand backup for named snapshots; PITR for continuous window; export for analytics copies. Cost awareness: capacity and cost.
What you'll learn in this chapter
- Explain PITR vs on-demand backup
- Run backup and restore mental RPO/RTO
- Use CLI for backups and continuous status
- Map across industries
- Lab + cleanup
1. Everyday example: phone photos
On-demand backup = freeze one album now. PITR = rewind timeline within days. Export = copy album to a USB (S3). Meera restores a wrong delete with PITR; weekly on-demand before schema changes.
2. Vertical steps
3. Why do we need this?
Why do we need this?
Fat-finger deletes, bad deploys, and ransomware need table-level recovery. App-level undo is not enough for whole-table mistakes.
4. What is it?
What is it?
On-demand backup: full snapshot you name. PITR: continuous backups, restore to a second within the window (commonly up to 35 days). Export: dump to S3 (not a hot failover). Restore creates a new table — cutover is your job.
5. How to do it (step by step)
How to do it (step by step)
- Write RPO/RTO for the table.
- Enable PITR on irreplaceable tables.
- Take on-demand backup before risky changes.
- Practice restore to a new lab table; verify item counts.
- Export to S3 when analytics need a copy.
- Document IAM who can restore; run quarterly drill.
6. Commands with output and meaning
aws dynamodb update-continuous-backups --table-name lab-ddh-bak \
--point-in-time-recovery-specification PointInTimeRecoveryEnabled=true
aws dynamodb describe-continuous-backups --table-name lab-ddh-bak
# Output: PointInTimeRecoveryStatus ENABLED
aws dynamodb create-backup --table-name lab-ddh-bak --backup-name lab-ddh-$(date +%Y%m%d%H%M)
# Output: BackupStatus CREATING then AVAILABLE
aws dynamodb list-backups --table-name lab-ddh-bak
Enable PITR; describe confirms. create-backup names a snapshot. Restore APIs create a new table — plan cutover.
7. Industry stories
- Bank (Lucas): PITR on ledger; quarterly restore drill.
- SaaS (Omar): on-demand before migration weekends.
- Retail (Aisha): export nightly for BI; PITR for ops.
- Healthcare (Rohan): backup vault policies + IAM break-glass.
- Gaming (Carlos): PITR off on disposable leaderboard labs.
- Travel (Omar): restore runbook includes GSI recreate checks.
8. Lab
How to do it (step by step)
- Create lab-ddh-bak; put 3 items; enable PITR; create-backup.
- describe-continuous-backups; list-backups.
- Delete backups you created if charged; delete table.
Cleanup (stop billing)
- Delete lab resources you created.
- Confirm with describe that names are gone.
9. Ops checklist before you ship
- Confirm TTL attribute name and units (epoch seconds).
- Decide soft-delete vs hard-delete vs archive-to-S3.
- Enable PITR on any table you cannot rebuild from source.
- Document RPO/RTO and who runs restore drills.
- If multi-region: pick write stickiness and conflict rules.
- If DAX: prove cache-miss path and warm-up plan.
- Tag Owner + Expiry on every lab resource.
- Budget alert in the account before load tests.
10. Copy-paste DynamoDB CLI starters (batch 2)
export AWS_DEFAULT_REGION=ap-south-1
# TTL status
aws dynamodb describe-time-to-live --table-name ShopApp
# PITR / continuous backups
aws dynamodb describe-continuous-backups --table-name ShopApp
# On-demand backup
aws dynamodb create-backup --table-name ShopApp --backup-name lab-shop-$(date +%Y%m%d)
# List backups
aws dynamodb list-backups --table-name ShopApp
# Global table description (v2)
aws dynamodb describe-table --table-name ShopApp --query 'Table.Replicas'
11. More industry stories
- Retail (Aisha Khan, Dubai): TTL clears abandoned carts; soft-delete keeps 30-day undo.
- Bank (Lucas Meyer, Berlin): PITR on ledger table; restore drill every quarter.
- Travel (Omar Haddad, Amman): Global Tables for catalog reads; inventory writes sticky.
- Gaming (Carlos Rivera, Mexico City): DAX for hot profile Gets; never cache money ledgers.
- Social (Priya Nair, Kochi): adjacency edges for follows; sparse GSI for unread inbox.
- IoT (Mei Lin, Shenzhen): device#day PK + TTL 14 days; rollups to S3.
12. Glossary (batch 2)
| Term | Meaning |
|---|---|
| TTL | Time to Live — attribute with epoch seconds; DynamoDB deletes later |
| Soft delete | Flag deleted=true; item remains until TTL/archive |
| PITR | Point-in-time recovery — continuous backups window |
| Global Table | Multi-region replicated DynamoDB table |
| LWW | Last-writer-wins conflict resolution on replicas |
| DAX | DynamoDB Accelerator — in-memory cache cluster |
| Adjacency list | Edge items modeling relationships in one table |
| Fan-out | Write once; push copies to many feeds/inboxes |
13. Practice: explain out loud
- 60s: TTL vs soft-delete vs S3 archive.
- 60s: PITR vs on-demand backup.
- 60s: when Global Tables help and hurt.
- 60s: DAX consistency trade-off.
- 60s: CartLite checkout keys in one breath.
- 60s: follow edge vs feed item.
- Record once; cut filler; record again.
14. Safe lab hygiene
- Use ap-south-1 labs with a budget alert.
- Prefix lab tables with lab- and your initials.
- Delete replicas, DAX clusters, and backups you created for labs.
- Never enable Global Tables on production without a write plan.
- Tag every resource Owner + Expiry.
- Export/import labs can create large S3 bills — delete prefixes.
15. How this set links other chapters
- Data modeling — keys we reuse in projects.
- Transactions — checkout and seat patterns.
- Streams + Lambda — fan-out and CDC.
- CRUD survey — short TTL note we deepen.
- What Is DynamoDB? — intro.
16. Delete / archive decision pad
| Need | Prefer | Why |
|---|---|---|
| Undo 7-30 days | Soft-delete flag | User restore |
| Hard expiry, no read | TTL attribute | Auto delete later |
| Compliance keep cold | Export/archive to S3 | Cheap long store |
| Mistake recovery | PITR / backup | Table-level restore |
17. Ten oral drill questions
- What units does DynamoDB TTL use?
- Does TTL delete instantly?
- PITR window typical length?
- Global Tables conflict default?
- When sticky writes matter?
- DAX vs API Gateway cache?
- Cart PK for a shopper?
- Order lines under which PK?
- Follow edge SK example?
- Unread inbox sparse GSI idea?
18. RPO / RTO mini workshop
- Write the worst data loss you can accept (RPO) in minutes.
- Write how long restore may take (RTO) before business pain.
- Map: on-demand backup vs PITR vs multi-region replica.
- Schedule a restore drill on a lab table this month.
- Name the person who runs the drill.
19. Cost watch list (batch 2)
- PITR storage and on-demand backup storage.
- Global Tables: replicated WCUs in every region.
- DAX node hours even at idle.
- Export to S3 + S3 storage + Athena later.
- Streams + Lambda still bill during TTL deletes.
20. Project Definition of Done
- Access patterns written and peer-reviewed.
- Sample items drawn for happy path + one failure.
- Lab table created, exercised, deleted (or tagged Expiry).
- At least one conditional write or transaction exercised.
- Cleanup commands pasted in your notes.
- One interview answer recorded out loud.
21. Cross-links inside this batch
- TTL hygiene → Backup/PITR for “oops” recovery.
- Global Tables → sticky writes from capacity/hot lessons.
- DAX → only after Query shapes are correct.
- P1 CartLite reuses modeling + transactions.
- P2 Social reuses adjacency + Streams ideas.
22. Quick self-check (yes/no)
- I can explain TTL delay vs instant DeleteItem.
- I know when soft-delete beats hard delete.
- I can start PITR and say what restore costs in time.
- I can name one reason NOT to use Global Tables.
- I know DAX does not fix a bad partition key.
- I can sketch CartLite USER# and ORD# keys.
- I can sketch a follow edge item.
- I delete lab replicas/DAX/backups the same day.
23. Common errors and fixes
Each row is a real mistake students and juniors hit. Read the fix before you panic.
| Error / symptom | Fix |
|---|---|
| PITR never drilled | Quarterly restore. |
| Restore overwrites prod name | Restore to new table. |
| Export = HA failover | Export is copy, not failover. |
| No IAM for restore | Break-glass role. |
| Backup before every Put | Only risky changes. |
| Ignore backup storage cost | Watch bill. |
| Forget GSIs after restore | Verify indexes. |
| PITR on disposable labs forever | Disable when done. |
| RPO undocumented | Write minutes. |
24. Troubleshooting checklist
- PITR Enabling long: wait/describe.
- Backup CREATING stuck: check IAM.
- Restore slow: size + indexes.
- Missing items: wrong time restore.
- Bill spike: backups+PITR+export.
25. FAQ
Q. Should I always use a single table?
Often yes for related access patterns; not a religion. Separate tables are fine for unrelated domains or different capacity/security needs.
Q. Do I still need RDS?
Yes for heavy joins, multi-row SQL reports, and strong relational constraints. See the intro DynamoDB vs RDS chapter.
Q. Is Scan evil?
Scan is a tool for rare admin jobs and small tables. Design so hot paths use Query/GetItem.
Q. Where are Put/Get command details?
In the CRUD survey, CLI and SDK chapters — this deep set links them instead of copying.
Q. PITR vs backup?
PITR continuous window; backup named snapshot.
Q. Restore in place?
Creates new table; you cut over.
Q. Export replaces PITR?
No — different purpose.
Q. Cost chapter?
Yes — capacity/cost link.
26. Interview Q&A
Q. (B) PITR meaning?
Restore to a second in the continuous window.
Q. (B) On-demand backup?
Named full snapshot.
Q. (M) Restore target?
New table; cutover planned.
Q. (M) RPO?
Max acceptable data loss.
Q. (S/MNC) Drill fail reason?
Often IAM/permissions.
Q. (MNC) When export?
Analytics/offline copy — not failover.
27. Tips in English, Marathi and Hindi
Ravindra Bagale's Tip (EN)
A backup without a restore drill is a story, not a plan.
Ravindra Bagale's Tip (MR)
Restore drill नसलेला backup = story.
Tip (HI)
बिना restore drill backup सिर्फ कहानी है।
Try at home
- Write RPO/RTO for one table.
- Enable PITR on a lab; disable after.
- Draft a 5-line restore runbook.
In short
- PITR = continuous; backup = snapshot.
- Restore makes a new table.
- Drill IAM quarterly.
- Watch backup storage cost.
Revision, interview and comparison cards
Revise this lesson in a few minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens this lesson.








More cards: Ravi Sir's Cards.
Practice Tasks
Vidarbha Cotton Mills is a textiles business in Nagpur. Ganesh Wankhede looks after its IT and cloud work. They count money in INR and run their AWS resources in the ap-south-1 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.
0 / 16
Easy PITR is a continuous window — 1
Why: Def.
What to do: Enter 1 if PITR lets you restore within a continuous window.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy On-demand backup is a snapshot — 1
Why: Def.
What to do: Enter 1 if on-demand backup creates a named snapshot.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy Restore creates a new table — 1
Why: Restore.
What to do: Enter 1 if restore typically creates a new table.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy Export is not hot failover — 1
Why: Purpose.
What to do: Enter 1 if S3 export is for copies/analytics not hot HA.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy Describe table
Why: CLI.
What to do: Describe table ShopApp
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Easy Tool pick YAML
Why: Choose.
What to do: YAML: continuous: pitr, snapshot: on-demand-backup.
- Start from the top-level keys the task names.
- Indent child keys with 2 spaces (no tabs).
- Fill in each property with the value from the task.
- Click Check answer. Key order does not matter.
Easy Plan cutover after restore — 1
Why: Ops.
What to do: Enter 1 if app/DNS cutover must be planned after restore.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium RPO is max data loss — 1
Why: Def.
What to do: Enter 1 if RPO is max acceptable data loss.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium RTO is restore duration target — 1
Why: Def.
What to do: Enter 1 if RTO is how long restore may take.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium Drills often fail on IAM — 1
Why: Drill.
What to do: Enter 1 if restore drills often fail on permissions.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium Backup storage costs money — 1
Why: Bill.
What to do: Enter 1 if backup/PITR storage appears on the bill.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium RPO RTO YAML
Why: Write.
What to do: YAML: rpo_minutes: 5, rto_minutes: 60.
- Start from the top-level keys the task names.
- Indent child keys with 2 spaces (no tabs).
- Fill in each property with the value from the task.
- Click Check answer. Key order does not matter.
Hard Backup before risky changes — 1
Why: Habit.
What to do: Enter 1 if you take on-demand backup before risky changes.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Hard Verify indexes after restore — 1
Why: Check.
What to do: Enter 1 if you verify GSIs/indexes after restore.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Hard Disable PITR on disposable labs — 1
Why: Hygiene.
What to do: Enter 1 if disposable labs should not keep PITR forever.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Hard Quarterly restore drill — 1
Why: Ritual.
What to do: Enter 1 if a quarterly restore drill is a good ritual.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.