Writing a runbook you can use at 3am
A runbook is written by someone who is awake, has context and has time. It is read by someone who has none of those. Most runbooks fail because they are written for the first person.
The test is simple: could an engineer who has never touched this service, paged in the middle of the night, follow the page from top to bottom and either fix the problem or know exactly who to call? If not, the runbook is documentation, not a runbook.
1. What a runbook is for
A runbook has one job: take a known symptom to a known safe state, quickly, without the reader needing to think hard.
That means it is not:
- An architecture document. Link to one if you need to, but don’t make the reader scroll through it.
- A debugging guide for unknown problems. A runbook covers failures you have seen or can predict. For everything else, its job is to tell the reader when to stop and escalate.
- A place to show off. Short, boring and correct beats clever.
One runbook per alert, or per clear symptom, is a good default. If an alert has no runbook, either write one or ask whether the alert should page anyone at all.
2. Start from the alert
The reader arrives from a page. The top of the runbook should match what they just saw:
- The alert name, exactly as it appears in the page. People search for it.
- What the alert means in one sentence. “Requests to the payment API are failing above the error threshold for 5 minutes” is useful. “Error rate high” is not.
- A link to the dashboard or query behind the alert. The reader should be one click from the graph that fired.
It also helps to link the runbook from the alert itself, so the page carries the URL. Nobody should have to hunt for it in a wiki.
3. Check the impact first
Before fixing anything, the reader needs to know how bad it is. That decides whether to work alone, wake someone, or declare an incident.
Give them concrete checks:
- Which users or services are affected, and how to see that.
- Whether it is getting worse, steady or recovering.
- Which thresholds mean “this is an incident, follow the incident process now”.
Write the thresholds down. Under pressure, “use your judgement” usually means “do nothing for twenty minutes”.
4. Prerequisites and access
The most common way a runbook fails at 3am is not a wrong command. It is the reader not having access to run it.
List up front:
- Which accounts, roles or groups are needed.
- How to get elevated access, including any break-glass procedure, and who approves it.
- Which hosts, bastions or consoles to use.
- Any tools that must be installed locally, with versions if it matters.
On-call engineers should check this list before their shift, not during the page.
5. Commands you can copy and paste
Every action should be a command the reader can copy, paste and run. Not a description of what to do.
Bad:
Restart the worker on the affected node.
Better:
# Find the node reporting errors
kubectl -n orders get pods -l app=order-worker -o wide
# Restart the worker deployment
kubectl -n orders rollout restart deployment/order-worker
Some rules that help:
- Use placeholders that stand out, like
<NODE_NAME>, and say where the value comes from. Better still, give a command that prints it. - Show the expected output. If the reader doesn’t know what “good” looks like, they can’t tell whether the step worked.
- Avoid long one-liners with pipes and loops unless they have been tested exactly as written. They break in quiet ways.
- Mark anything destructive clearly, and say what it affects before the command, not after.
- Say whether a step is safe to repeat. If someone runs it twice by accident, what happens?
Example with expected output:
kubectl -n orders rollout status deployment/order-worker --timeout=120s
Expected:
deployment "order-worker" successfully rolled out
If it times out instead, go to the rollback section. Don’t keep retrying. The same reasoning applies as in Timeouts and retries without making outages worse: repeating an action that isn’t working usually adds load without adding information.
6. Verify after each step
Every step needs a check that says whether it worked. Not only at the end.
- After a restart: is the process up, and is it serving traffic?
- After a failover: is traffic actually going to the new target?
- After a config change: did it apply on every host, or only some?
The best verification is the same signal that fired the alert. If the alert was on error rate, the check is “error rate back below threshold on the dashboard linked above”. That ties the fix to the symptom, rather than to the reader’s belief that the fix should have worked.
7. Rollback
Each change step should have a way back, written next to it or in a dedicated section:
- How to undo the step.
- How to confirm the undo worked.
- What state the system will be in afterwards.
If a step has no safe rollback, say so plainly before the step, and make it a point where the reader escalates or gets a second person to check.
8. Escalation: when and to whom
A runbook should make escalation an easy, expected outcome, not a failure.
Write down:
- When to escalate. Concrete triggers: impact above a threshold, a step failed, the runbook doesn’t match what you see, or a time limit has passed without progress.
- Who to escalate to. A team rota or on-call schedule, not a named person who may be on leave.
- How to reach them. The paging tool, the channel, the phone bridge.
- What to send. Alert name, impact, what has been tried, and current state. A short template saves time.
Many incident response processes separate the person coordinating from the people fixing. If yours does, the runbook should say at what point that structure kicks in and link to the process.
9. Keeping it current
A runbook that was right last year is a risk, because it looks trustworthy.
- Review after every incident that used it. One of the postmortem actions should be “update the runbook”: fix commands that failed, add the step that was missing, remove the step that didn’t help.
- Test in drills. Have someone who didn’t write it follow it in a test environment, or in a game day. Wherever they hesitate is where the runbook needs work.
- Put an owner and a last-reviewed date at the top. A stale date is a visible warning.
- Keep it near the code if you can. Runbooks stored in the same repository as the service get reviewed with the changes that break them.
The same problem shows up in configuration. As covered in Detecting configuration drift with Ansible check mode, the documented state and the real state drift apart unless something checks them regularly. Runbooks drift the same way, and drills are the check.
10. Common failure modes
- Stale commands. Hostnames, namespaces, flags and tool versions change. The runbook still says the old thing. Drills and post-incident updates are the only reliable fix.
- Assumed context. “Check the usual place”, “restart it the normal way”, acronyms with no explanation. The writer knows what they mean. The reader at 3am may not.
- Wall of text. Paragraphs of background before the first action. Put the actions first, background last or behind a link.
- No expected output. The reader runs a command, gets output, and can’t tell if it’s good.
- No exit. The runbook ends without saying what to do if the problem is still there. Every runbook should end with escalation.
- Too many branches. If a runbook needs a decision tree five levels deep, it is probably several runbooks.
11. A short template
# <Alert name, exactly as it appears in the page>
Owner: <team> Last reviewed: <YYYY-MM-DD>
Alert/dashboard: <link>
## What this means
<One sentence: what is broken and for whom.>
## Check impact
1. <Command or dashboard link>
Expected if healthy: <output>
2. Declare an incident if: <concrete thresholds>
## Before you start
- Access needed: <roles/groups>, how to get it: <link>
- Run from: <host/console>
## Fix
### Step 1: <action>
<command>
Expected: <output>
Verify: <check>
If it fails: go to Rollback / Escalate.
Safe to repeat: yes/no
### Step 2: <action>
...
## Rollback
<command to undo each step>
Verify: <check>
## Escalate
Escalate if: <triggers, including a time limit>
To: <rota/schedule>, via: <paging tool/channel>
Send: alert name, impact, steps tried, current state.
## Background (optional)
<Links to architecture docs, dashboards, past postmortems.>
12. Summary
- Write for the reader who has no context, not for yourself.
- Start from the alert, check impact, then act.
- Every action is a command with expected output and a verification.
- Every change has a rollback, and every runbook ends with escalation.
- Review after incidents and test in drills, or it will go stale.
References
- Google SRE book, Being On-Call.
- Google SRE book, Managing Incidents.
- Google SRE book, Postmortem Culture: Learning from Failure.
- Google SRE workbook, On-Call.
- PagerDuty, Incident Response Documentation.