OPS-46Recommended
Keep backups for a set time
Keep each backup for a fixed period, such as 35 days of daily copies, and let the storage delete it when the period ends.
How to do it
Pick the period from the oldest mistake you need to undo, such as a bad import found weeks later. Daily copies for 30 to 35 days suit most services. Keep monthly copies longer only when a law or contract asks, and write down why. Set the expiry in the storage itself, such as an S3 lifecycle rule, so it runs even when the server is gone. Set the object lock to the same period, never longer. Backups are not edited to honour an erasure request. The erased data leaves with the backups as they expire, and a restore runs the erasure log again, as data requests says. Name the period in the privacy notice and in the retention schedule.
Examples
JSON example
{
"Rules": [{
"ID": "expire-daily-backups",
"Filter": { "Prefix": "daily/" },
"Status": "Enabled",
"Expiration": { "Days": 35 },
"NoncurrentVersionExpiration": { "NoncurrentDays": 1 }
}]
}
Shell example
# restic: keep 35 daily snapshots, then prune the data they no longer use
restic forget --keep-daily 35 --prune
How to check
The oldest backup in the off-site store is no older than the period plus one day. The retention schedule and the storage's expiry rule name the same period.
Sources
Related rules
- WEB-217 Let people see and delete their data in Website
- DAT-31 Delete old data automatically in Data and databases
- DAT-35 Erase retired databases and every copy in Data and databases
- DAT-72 Delete every copy of a tenant when the contract ends in Data and databases
- OPS-45 Back up off the machine in Operations and observability
- OPS-80 Keep one backup copy that no account can delete in Operations and observability
- CMP-11 Keep one retention schedule in Compliance and governance
- MED-4 Keep deleted files restorable for 30 days in Files and media
- MED-5 Back up user files outside their bucket in Files and media
- MED-49 Delete files when their owner is deleted in Files and media
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/operations/disaster-recovery/backup-retention">Agent Wranglers operations and observability playbook</a>. In code you write, add a comment next to it with the same link.