You run pg_basebackup every night. It exits 0. The cron log is clean. Then a bad migration drops a table at 14:20, and you discover the restore takes 40 minutes, the last good WAL segment is 19 hours old, and your app config points at the production container — so the "test restore" was never isolated from prod. The backup was fine. The recovery was fiction.
The gap is almost never the copy itself. It is the untested assumption about how much data you can lose (RPO — recovery point objective, measured in lost time/transactions) and how long you can be down (RTO — recovery time objective, measured in minutes to service). A backup you have never restored has an unknown RPO and an infinite RTO until proven otherwise.
What follows is a prompt kit for putting an LLM to work on the boring, specific parts: reading your backup scripts, crunching logs, generating restore drills, and stress-testing the policy. Each prompt is copy-paste ready. Feed the model real artifacts — scripts, log tails, config — not descriptions.
Start by forcing the model to compute your real RPO/RTO, not your stated one
Most teams have RPO/RTO written in a wiki and a completely different reality in cron. The first prompt makes the LLM derive the actual numbers from your schedule and WAL/archive settings, then compare against the stated target.
Prompt:
You are a database reliability engineer. Below are my backup crontab, my PostgreSQL settings for archiving, and the stated objectives. Compute the EFFECTIVE RPO and RTO from the schedule and settings, not from what we claim. Show the math. Then list every assumption that could make the real numbers worse (e.g. archive_command failures not alerting, base backup duration overlapping the next run, retention shorter than the restore window).
Stated RPO: <e.g. 15 minutes>
Stated RTO: <e.g. 60 minutes>
Crontab:
<paste>
postgresql.conf (relevant lines):
<archive_mode, archive_command, wal_level, wal_keep_size>
Usage example: a team claims 15-minute RPO but runs pg_basebackup nightly with WAL archiving to the same disk. The model points out that RPO is bounded by WAL archive latency, not the nightly base backup — and that if the archive disk dies with the primary, effective RPO is 24 hours. More on the topic: “Cloud Backup vs Self-Hosted Backup for Your Photo Archive: Pick by Recovery Speed, Not Storage Price”.
Make the LLM audit the backup script line by line
Scripts rot. Someone adds --exclude for a noisy directory, someone pipes through gzip without checking the exit code, someone runs mysqldump without --single-transaction and quietly gets an inconsistent snapshot under load.
Prompt:
Act as a skeptical SRE reviewing this backup script for correctness, not style. For each command, tell me: (1) what it actually backs up, (2) how it can silently produce a corrupt or incomplete artifact, (3) whether a failure would be detected by the script's own exit code, (4) whether the artifact is verified after writing. Flag missing set -euo pipefail, unchecked pipes, and any step where a partial file looks like success. Output a table: line
| risk | consequence | fix.
Script:
<paste>
Usage example: with a mysqldump | gzip > backup.sql.gz line, the model notes that gzip succeeding masks a mysqldump failure unless pipefail is set — you get a valid gzip of a truncated dump, and every restore drill "passes" until it doesn't.
Turn pg_basebackup / mysqldump / restic logs into a verdict
Logs are where the truth hides. A pg_basebackup that reports success can still have skipped a tablespace; a restic check that ran with --read-data-subset only sampled part of the repo.
Prompt:
Read these backup tool logs and answer three questions only: (1) did this run produce a restorable artifact — yes/no/unknown, with the exact log line that justifies it; (2) what integrity verification actually ran versus what was skipped; (3) what is the single scariest line in the log. Do not summarize the whole log. Be blunt about 'unknown'.
Tool: <pg_basebackup
| mysqldump | restic>
Log:
<paste tail>
Usage example: a restic log shows check with a subset flag. The model flags that only a fraction of pack files were read, so bit-rot outside the sample is invisible — and recommends a scheduled full restic check --read-data on a rotation.
Generate a restore drill that actually proves RTO
A restore drill that runs on the same host, same credentials, and same network as production proves nothing about a real outage. The prompt builds a drill with a timer and a pass/fail criterion.
Prompt:
Design a restore drill for my stack that measures real RTO. Requirements: restore into an isolated network and fresh credentials, start a stopwatch at the moment of 'disaster', and record time-to-first-successful-query and time-to-application-healthy separately. Give me a numbered runbook, a results table to fill in, and the pass/fail thresholds tied to my stated RTO. Include the step most teams forget that inflates real RTO.
Stack: <Postgres 16 on <cloud>, app connects via <service>>
Stated RTO: <minutes>
Data size: <GB>
Usage example: the model separates "database up" from "app serving traffic" and points out that DNS/service reconfiguration and connection-pool warmup often add more to RTO than the restore itself.
Stress the retention and encryption policy for holes
Retention that is shorter than your detection time is a trap: if ransomware sits quietly for 30 days and you keep 14 days of backups, every copy is encrypted too. Immutability and object-lock settings matter more than the retention number.
Prompt:
Review this backup retention and encryption policy as an attacker and as an auditor. As the attacker: where can I delete or encrypt every copy before you notice? Consider credentials shared with prod, backups mounted writable, and repos without immutability. As the auditor: does retention exceed realistic detection time, are copies isolated from prod credentials, is encryption keyed separately from the data? Output two lists: holes and fixes, ranked by blast radius.
Policy:
<retention days, storage location, who has delete rights, encryption/key management>
Usage example: the model catches that the backup service account can delete its own repo — meaning a compromised app host can wipe backups — and recommends object-lock/immutability plus a separate, delete-restricted identity.
Run a chaos scenario to find the hole before it finds you
Finally, make the LLM write the failure scenario you are afraid of and walk your runbook against it, step by step, marking where it breaks.
Prompt:
Write a realistic disaster scenario for my setup: <e.g. primary disk corrupted at peak load, WAL archive on same host>. Then walk my restore runbook against it line by line. At each step, state whether it survives the scenario and what the operator would actually see. End with the one change that most reduces RTO.
Runbook:
<paste>
Usage example: the scenario assumes the WAL archive is gone with the disk; the runbook's first step is "restore latest base backup and replay WAL" — the model marks it as failing and redirects to "restore from off-host archive, accept RPO loss, document it."
The habit that beats any single prompt
A prompt kit is not a backup strategy. The strategy is: explicit RPO/RTO you can defend, copies isolated from production credentials, integrity verified after writing, and a drill on a schedule with a stopwatch. The LLM's job is to be the tireless reviewer that reads the script, the log, and the runbook with fresh eyes and no optimism — the reviewer who assumes it is broken until proven restored.
- Exits 0 in cron
- RPO: unknown
- RTO: unknown
- Integrity: assumed
- Isolation: shares prod credentials
- Timed restore on isolated host
- RPO: measured gap
- RTO: time-to-app-healthy
- Integrity: verified after write
- Isolation: separate identity, immutable
Pick one prompt above, run it against your real artifacts this week, and let it tell you the number you have been avoiding: how long you would actually be down. If the answer scares you, that is the most useful result you will get all month.