Backup & Recovery
Purpose
Make data loss survivable, provably: recovery objectives set by the business, backups that meet them automatically, and rehearsed restores — because the only backup that counts is one that has been restored.
When to Use
- When provisioning any database, and periodically to re-verify (drills).
- Before risky operations:
data-migration runs, major database-migrations, deletions.
- Not as an afterthought at release — recovery objectives are requirements.
Inputs
- Business tolerance: how much data loss (RPO) and downtime (RTO) is survivable per dataset.
- Platform capabilities (managed snapshots, PITR/WAL archiving, Mongo oplog), data volume.
Discovery Questions
- What do RPO/RTO actually need to be — an hour of lost orders vs a day of lost analytics differ (
database-selection knows what lives where)?
- What failure classes are covered: hardware, region, operator error (bad migration, fat-fingered delete — the common one), account compromise, ransomware?
- Who restores at 3 a.m., following what runbook, with what access?
Responsibilities
- Set RPO/RTO per dataset with the business — recorded numbers, not vibes; they drive everything below.
- Design the backup scheme to meet them: automated scheduled full backups + point-in-time recovery (WAL/oplog archiving) where RPO is minutes; frequency, retention tiers (daily/weekly/monthly), and pruning policy recorded.
- Protect the backups themselves: off-site/cross-account/cross-region copies (a backup in the blast radius — same account, same region, deletable by the same compromised key — is not a backup); encryption at rest with keys managed separately (
database-security); immutability/deletion-protection where the platform offers it.
- Cover operator error explicitly: PITR to just-before-the-mistake; pre-operation snapshots as a standard step for
data-migration/destructive database-migrations.
- Write the restore runbook: exact steps, access needed, decision points (restore-in-place vs parallel-and-cutover, partial-table extraction), verification steps — executable by the on-call human, not just its author.
- Drill restores on a schedule: full restore to a scratch environment, timed against RTO, data verified (counts/spot checks); every drill recorded; a failed drill is a production incident in rehearsal — fix it.
- Monitor the pipeline: backup success/failure and staleness alerts (
../../backend/backend-observability) — silent backup death is the classic failure.
- Align PII retention/deletion with backups (
database-security): deleted-user data in year-old backups is a recorded, compliance-checked policy, not a surprise.
Required Workflow
- Record RPO/RTO per dataset with the business.
- Configure automated backups + PITR to meet them; set retention.
- Establish off-site copies, encryption, deletion protection.
- Write the restore runbook.
- Drill: restore, time it, verify data, record results; schedule recurrence.
- Wire failure/staleness alerts; standardize pre-operation snapshots.
Decision Rules
- RPO/RTO come from the business impact, and the scheme is derived — never the reverse ("daily dumps, so RPO is 24h, hope that's fine").
- Managed-platform backups are the default start; verify their restore path and cross-region story rather than assuming.
- Replicas are availability, not backups — they replicate the delete too.
- If the restore has never been run, the backup doesn't exist yet.
Rules
- Restore drills on a schedule, recorded, timed against RTO.
- Backup credentials/keys separated from production compromise paths.
- Every destructive operation is preceded by its snapshot (and says so in its runbook).
Anti-Patterns
- Nightly dump to the same disk/account and calling it covered.
- Backups configured once, never verified, dead for months.
- Replicas as the backup strategy.
- Restore knowledge living in one person's head.
- Discovering the backup excludes half the schemas during the incident.
- No PITR on a system whose RPO is "minutes, obviously."
Validation Checklist
Definition of Done
Recorded recovery objectives met by an automated, off-site, encrypted backup scheme with PITR where needed — proven by a timed, verified, recurring restore drill, with a runbook on-call can execute and alerts watching the pipeline.
Related Skills
database-security, data-migration (pre-op snapshots), database-migrations, ../../backend/backend-deployment, ../../backend/backend-observability, ../../release-planning (readiness gate).
Related Knowledge
../../../knowledge/ (business tolerance, platform capabilities).
Related References
../../../references/database/operations/ (runbooks, drill records, when populated).
Context Loading Guidance
- Requires: RPO/RTO inputs, platform capabilities, dataset inventory.
- Does not require: schema detail, application code.
- May load:
database-security (encryption/PII), data-migration (snapshot step).
- Stop when: scheme + runbook + drill results are recorded.
Token Efficiency Guidance
The RPO/RTO → scheme table and the drill log are the artifacts; keep platform specifics to links in references.
1---2name: backup-recovery3description: Use to plan backups and recovery — RPO/RTO targets, automated backups with point-in-time recovery where needed, off-site/cross-account copies, retention, encryption, and above all restore drills: an untested backup is a hope, not a plan.4---56# Backup & Recovery78## Purpose910Make data loss survivable, provably: recovery objectives set by the business, backups that meet them automatically, and **rehearsed restores** — because the only backup that counts is one that has been restored.1112## When to Use1314- When provisioning any database, and periodically to re-verify (drills).15- Before risky operations: `data-migration` runs, major `database-migrations`, deletions.16- **Not** as an afterthought at release — recovery objectives are requirements.1718## Inputs1920- Business tolerance: how much data loss (RPO) and downtime (RTO) is survivable per dataset.21- Platform capabilities (managed snapshots, PITR/WAL archiving, Mongo oplog), data volume.2223## Discovery Questions2425- What do RPO/RTO actually need to be — an hour of lost orders vs a day of lost analytics differ (`database-selection` knows what lives where)?26- What failure classes are covered: hardware, region, **operator error (bad migration, fat-fingered delete — the common one)**, account compromise, ransomware?27- Who restores at 3 a.m., following what runbook, with what access?2829## Responsibilities3031- Set **RPO/RTO per dataset** with the business — recorded numbers, not vibes; they drive everything below.32- Design the **backup scheme** to meet them: automated scheduled full backups + **point-in-time recovery** (WAL/oplog archiving) where RPO is minutes; frequency, retention tiers (daily/weekly/monthly), and pruning policy recorded.33- Protect the backups themselves: **off-site/cross-account/cross-region copies** (a backup in the blast radius — same account, same region, deletable by the same compromised key — is not a backup); encryption at rest with keys managed separately (`database-security`); immutability/deletion-protection where the platform offers it.34- Cover operator error explicitly: PITR to just-before-the-mistake; **pre-operation snapshots** as a standard step for `data-migration`/destructive `database-migrations`.35- Write the **restore runbook**: exact steps, access needed, decision points (restore-in-place vs parallel-and-cutover, partial-table extraction), verification steps — executable by the on-call human, not just its author.36- **Drill restores on a schedule**: full restore to a scratch environment, timed against RTO, data verified (counts/spot checks); every drill recorded; a failed drill is a production incident in rehearsal — fix it.37- Monitor the pipeline: backup success/failure and *staleness* alerts (`../../backend/backend-observability`) — silent backup death is the classic failure.38- Align PII retention/deletion with backups (`database-security`): deleted-user data in year-old backups is a recorded, compliance-checked policy, not a surprise.3940## Required Workflow41421. Record RPO/RTO per dataset with the business.432. Configure automated backups + PITR to meet them; set retention.443. Establish off-site copies, encryption, deletion protection.454. Write the restore runbook.465. Drill: restore, time it, verify data, record results; schedule recurrence.476. Wire failure/staleness alerts; standardize pre-operation snapshots.4849## Decision Rules5051- RPO/RTO come from the business impact, and the scheme is derived — never the reverse ("daily dumps, so RPO is 24h, hope that's fine").52- Managed-platform backups are the default start; verify their restore path and cross-region story rather than assuming.53- Replicas are availability, **not backups** — they replicate the delete too.54- If the restore has never been run, the backup doesn't exist yet.5556## Rules5758- Restore drills on a schedule, recorded, timed against RTO.59- Backup credentials/keys separated from production compromise paths.60- Every destructive operation is preceded by its snapshot (and says so in its runbook).6162## Anti-Patterns6364- Nightly dump to the same disk/account and calling it covered.65- Backups configured once, never verified, dead for months.66- Replicas as the backup strategy.67- Restore knowledge living in one person's head.68- Discovering the backup excludes half the schemas during the incident.69- No PITR on a system whose RPO is "minutes, obviously."7071## Validation Checklist7273- [ ] RPO/RTO recorded per dataset.74- [ ] Automated backups + PITR meet them; retention set.75- [ ] Off-site/cross-account copy, encrypted, deletion-protected.76- [ ] Restore runbook written and executable by on-call.77- [ ] Restore drill done, timed, verified, scheduled to recur.78- [ ] Staleness/failure alerts wired; pre-op snapshots standard.7980## Definition of Done8182Recorded recovery objectives met by an automated, off-site, encrypted backup scheme with PITR where needed — proven by a timed, verified, recurring restore drill, with a runbook on-call can execute and alerts watching the pipeline.8384## Related Skills8586`database-security`, `data-migration` (pre-op snapshots), `database-migrations`, `../../backend/backend-deployment`, `../../backend/backend-observability`, `../../release-planning` (readiness gate).8788## Related Knowledge8990`../../../knowledge/` (business tolerance, platform capabilities).9192## Related References9394`../../../references/database/operations/` (runbooks, drill records, when populated).9596## Context Loading Guidance9798- **Requires:** RPO/RTO inputs, platform capabilities, dataset inventory.99- **Does not require:** schema detail, application code.100- **May load:** `database-security` (encryption/PII), `data-migration` (snapshot step).101- **Stop when:** scheme + runbook + drill results are recorded.102103## Token Efficiency Guidance104105The RPO/RTO → scheme table and the drill log are the artifacts; keep platform specifics to links in references.