---
title: "Encrypt backups · Agent Wranglers"
url: https://agentwranglers.se/playbook/data/database-security/encrypted-backups
id: DAT-26
level: Required
risk: data
updated: 2026-10-27
build: a2a6bdfed830
tokens: 855
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Encrypt backups

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Database security](https://agentwranglers.se/playbook/data/database-security.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: DAT-26
- Level: Required
- Chapter: [Database security](https://agentwranglers.se/playbook/data/database-security.md)
- Rule: Encrypt every backup, and keep the key apart from the backups. Encrypt each dump you make yourself before it leaves the server.
- Check: Download a backup file you made. It cannot be opened without the key, and the private key is not on the database server. The managed database's settings show its backups encrypted.
- Risk: Data leaked or lost
- How: Encrypt with a public key, using a tool such as `age` or `gpg`, so the server holds only the key that locks. Or use storage-side encryption with a key you control. A managed database, such as RDS or Supabase, encrypts its own backups. Confirm the setting, and choose your own key where the service offers one. A dump you export from it, such as a nightly copy to a bucket, still needs its own encryption. Store the private key in a password manager or secret store, never next to the backups. The [encrypt data rule](https://agentwranglers.se/playbook/application-security/cryptography-and-keys/encrypt-data.md) covers data at rest in general.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### Shell example

```sh
pg_dump --format=custom shop | age -r age1examplepublickey... > shop-2026-10-20.dump.age
```

## Sources

- [GDPR Article 32 on security of processing](https://eur-lex.europa.eu/eli/reg/2016/679/oj)
- [OWASP Cryptographic Storage Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)

## Related rules

- ENG-43 [Run one-off tasks as reviewed scripts](https://agentwranglers.se/playbook/engineering/running-in-production/admin-tasks-as-code.md) in Engineering
- APS-54 [Encrypt data on the wire and on disk](https://agentwranglers.se/playbook/application-security/cryptography-and-keys/encrypt-data.md) in Application security
- OPS-45 [Back up off the machine](https://agentwranglers.se/playbook/operations/disaster-recovery/off-site-backups.md) in Operations and observability
- MED-5 [Back up user files outside their bucket](https://agentwranglers.se/playbook/files-and-media/storage-and-backups/file-backups.md) in Files and media

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/data/database-security/encrypted-backups">Agent Wranglers data and databases playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Turn off database features that reach the server](https://agentwranglers.se/playbook/data/database-security/server-file-access.md)
- Next: [Encrypt database storage with a key you control](https://agentwranglers.se/playbook/data/database-security/encryption-at-rest.md)
- [Database security](https://agentwranglers.se/playbook/data/database-security.md)
