Runbooks and reducing toil
Write runbooks that work at 3 a.m., measure the repeat work your team does by hand, and automate it step by step with safety limits.
Updated since you finished it. We changed this lesson after you marked it done. Your progress is kept.
What broke
On 28 February 2017 at 9:37 a.m. PST, an S3 engineer at AWS was debugging a slow billing system. They used "an established playbook" and ran a command to remove a few servers. 1
AWS wrote: "one of the inputs to the command was entered incorrectly". The command removed more servers than intended. 1
Those servers ran two S3 parts. One knows where every object is stored, and every request needs it. The other picks where new objects go. Both had to restart fully. 1 S3 was not fully back until 1:54 p.m. 1
The engineer followed a written runbook. AWS's fixes were not to the runbook or the person. They were to the tool, which AWS said "allowed too much capacity to be removed too quickly". 1
AWS changed the tool to remove capacity more slowly. It also refuses to take any subsystem below its minimum capacity. AWS said it was also auditing its other operational tools for similar safety checks. 1
This lesson is about that path: from a written runbook, to a script, to automation. Each step saves time. Each step also needs limits.
The idea in simple words
You met runbooks in Alerting and on-call. This lesson is about the work behind them.
Google's SRE book defines toil as "the kind of work tied to running a production service" that has six properties. 2 Not every toil task has all six. The more of them a task has, the more likely it is toil. 2
- Manual. Running a script by hand still counts. Your hands-on time is toil, not the time the script runs. 2
- Repetitive. The first or second time is not toil. Doing it again and again is. 2
- Automatable. A machine could do it as well as you. If it needs human judgement, it is probably not toil. 2
- Tactical. It is driven by interrupts, not by a plan. Handling pages is toil. 2
- No lasting value. After the task, the service is in the same state as before. 2
- Grows with the service. Twice the traffic or users means twice the work. 2
Some work is not toil. Meetings, goal setting and HR paperwork are overhead. 2 Hard cleanup that makes the service better for good is not toil either. 2
Google's SRE teams aim to keep toil below 50% of each person's time. 2 In Google's quarterly surveys, the average was about 33%. Some people reported 0% and some 80%. 2 The book warns that too much toil leads to burnout, boredom and discontent. 2
The key idea. A good runbook makes manual work fast and safe. Then measure that manual work, and turn the biggest pieces into code, one step at a time. Give every piece of automation limits, so one mistake cannot spread.
How it works
1. Write a runbook people can follow at 3 a.m.
Google found that a written "playbook" gives "roughly a 3x improvement" in time to repair, compared with "winging it". 4 As you saw in the alerting lesson, PagerDuty says alerts with neither steps nor a runbook link "are useless". 7
Our advice: a runbook needs these parts, in this order.
# Runbook: DiskFull on app workers
Owner: payments-platform Last tested: 2026-10-14 (game day)
Impact: uploads fail on this host. Users see "try again".
Quick check (30 s):
ssh <host> df -h /var/log
If use < 90%: the alert was a blip. Stop.
Fix:
1. ssh <host> 'sudo find /var/log/app -type f -exec du -h {} + | sort -h | tail -5'
2. If the biggest files are old *.gz logs:
ssh <host> 'sudo find /var/log/app -type f -name "*.gz" -mtime +7 -delete'
3. Else: do not delete. Escalate to #payments-oncall.
Undo: you cannot undo the delete on the host.
Copies of these logs stay in the log store for 30 days.- Impact first. The reader learns how bad it is before anything else.
- A quick check. It tells the reader if they can stop.
- Commands you can copy and paste. No "check the disk somehow".
- Decision points. Say what to do in each case, including "stop and escalate".
- Rollback. Say how to undo each step, or say clearly that you cannot.
- Owner and last-tested date. A runbook with no owner goes stale.
2. Keep runbooks alive
Runbooks rot. Commands change, hosts get new names, dashboards move. Google's automation chapter calls this "bit rot" when it happens to automation kept apart from its system: the system changes and the automation does not. 5 A runbook kept apart from the system has the same risk.
Our advice: test runbooks on a game day. Break a test system on purpose and let a new team member follow the runbook alone. Fix every step where they get stuck. Google also uses practice exercises, such as the "Wheel of Misfortune", to prepare engineers for on-call. 4
3. Measure toil before you fix it
Google's workbook says intuition is not "repeatable, objective, or transferable". 3 So measure.
- Pick a unit. Minutes and hours are the natural choice. Count the cost of context switching too. 3
- Track it over time. Measure before, during and after a fix. 3
- Rank it. Google SRE teams often track toil in bugs and rank it by "the cost to fix it and the time saved". 3
The workbook also says eliminating toil "isn't always the best solution". 3 Sometimes the best first move is to reject the task. Or batch it, to cut interrupts and see patterns. 3
4. Climb the automation ladder
The ladder below is our own framing. Google's SRE book describes a different five-step path. It is about where automation lives: from "No automation", through scripts kept outside the system, to "Systems that don't need any automation". 5
- A made-up example. A worker's disk fills about 6 times a week. Each time, someone logs in and finds what to delete from memory. That takes about 20 minutes, so 2 hours a week.
- The team writes a runbook with exact, tested commands. Nobody has to think about the order any more. Each run now takes about 12 minutes. The numbers are a made-up example.
- The runbook steps become a script with one safety check at the start. A person still starts it, but each run takes about 4 minutes. Self-service is left out here: it moves the work to other teams.
- The alert now runs the script by itself. The script has limits, such as how many files it may delete. If a limit is hit, it stops and pages a human. Say that happens about once a week, for about 6 minutes.
- Best of all, remove the cause. With log rotation set up, the disk never fills, and the task disappears. Google's workbook calls this the optimal strategy.
Doc to script. Google's workbook says runbook steps are "essentially pseudocode" to a software engineer. 3 A good first script is a do-nothing script. Dan Slimmon describes it as a script that puts each step of a manual task in a function. 6 At first, each function only prints the step and waits. 6
#!/usr/bin/env python3
"""Do-nothing script: free disk space on an app worker.
Each step only prints what to do, then waits for you."""
def check_disk(host):
print(f"1. Run: ssh {host} df -h /var/log")
print(" If use is below 90%, stop here.")
def find_big_logs(host):
print(f"2. Run: ssh {host} 'sudo find /var/log/app -type f -exec du -h {{}} + | sort -h | tail -5'")
def delete_old_logs(host):
print("3. Only if the biggest files are old *.gz logs. Otherwise do not delete: escalate to #payments-oncall.")
print(f" Run: ssh {host} 'sudo find /var/log/app -type f -name \"*.gz\" -mtime +7 -delete'")
def main():
host = input("Host name: ")
for step in (check_disk, find_big_logs, delete_old_logs):
step(host)
input(" Done? Press Enter to continue, or Ctrl+C to stop. ")
if __name__ == "__main__":
main()It looks useless, but you lose your place less often. And you can replace one step at a time with real code. Slimmon says it "lowers the activation energy for automating tasks". 6
Script to self-service. Let other teams run the task themselves. The workbook suggests a web form, script, API or documented pull request. 3
Self-service to auto-remediation. The alert runs the fix with no human. Our view: this step removes the most human time, and it carries the most risk.
The diagram leaves out self-service, because it moves the work to other teams rather than removing it.
Fix the cause. The workbook calls removing toil at its source "the optimal strategy". 3
5. Give automation limits
Automation repeats a mistake as fast as it repeats a fix. Google's SRE book tells a story from its own CDN. A disk-erase job got an empty list of machines. The empty list was read as "everything". 5 "Within minutes", it wiped the disks of all machines in Google's CDN. 5 Afterwards, Google added more sanity checks, including rate limiting, and made the workflow idempotent. 5
The workbook gives clear rules: 3
- Check input carefully, even input from other systems.
- Add safeguards, such as timeouts or checks of current metrics.
- "Automation should default to human operators if it runs into an unsafe condition."
AWS's fix after S3 follows the same idea: go slowly, and refuse to go below a minimum. 1
Trade-offs
| Step | Human time per run | Cost to build | Main risk |
|---|---|---|---|
| Runbook | High. | Low. | Goes stale. People skip or mistype steps. |
| Do-nothing script | Same as the runbook. | Very low. | Feels like no progress, so people stop. |
| Script run by a person | Low. | Medium. | One wrong input acts on many hosts, as in the S3 outage. |
| Self-service tool | None for your team. | Medium to high. | Other teams use it in ways you did not plan for. |
| Auto-remediation | None, unless it pages a person. | High. | It hides a growing problem, or repeats a mistake at machine speed. |
| Fix the cause | None. The task is gone. | Often highest. | Takes the longest, so the toil continues until it ships. |
At work: how a senior uses this
- Link a runbook from every page. If an alert has no runbook, write one in the next postmortem.
- Put an owner and a "last tested" date at the top. Our advice: treat a runbook not tested in 6 months as untrusted.
- Keep a toil log for a month. Each entry has the task, minutes spent and what triggered it.
- Rank the log by minutes per month and by cost to fix. Bring the top three to planning.
- Ask "can we stop doing this?" before "can we automate this?". The workbook puts rejecting the task first. 3
- In code review of any automation, ask: what is the most it can change at once? What happens with empty or wrong input? When does it stop and page a person?
- Watch for growth. If a task doubles when traffic doubles, it will not wait for you to have time.
With AI
What to ask the agent
"Here is our Slack thread and timeline from last night's DiskFull incident. Draft a runbook with: impact, a 30-second quick check, copy-paste commands, decision points, rollback, owner and a last-tested field. Mark any command you are not sure about."
"You are on call with read-only access. For the alert DiskFull on worker-7, run only read commands: df, du, ls, journalctl. Show me each command and its output. Propose a fix, but do not run any command that changes or deletes anything."
"Turn this runbook into a do-nothing script in Python. Each step is a function that prints the exact command and waits for Enter."
What to check yourself
- Run every command the agent wrote on a test host first. Agents can invent flags or paths.
- Check that "read-only" is enforced by permissions, not only by the prompt. Our advice: give the agent a read-only account, and approve every change yourself.
- Check delete and restart commands for limits: a path, an age, a host list, never "all".
- Make sure the runbook says how to undo each step.
- See Working with coding agents for permission settings and review habits.
Check yourself
Your progress is saved only in this browser. Export it to keep it safe.
You have finished 5 lessons. Your progress lives only in this browser. Export a copy so you don’t lose it.
Go deeper
Show 7 sources and related lessons
- Amazon Web Services, “Summary of the Amazon S3 Service Disruption in the Northern Virginia (US-EAST-1) Region” (opens in a new tab)
AWS's own account of the 2017 S3 outage, the playbook command with one wrong input, and the safety limits added to the tool. - Vivek Rau, “Eliminating Toil”, Google, Site Reliability Engineering, chapter 5 (opens in a new tab)
Google's definition of toil, its six properties, what is not toil, and the 50% goal for engineering work. - Google, “Eliminating Toil”, The Site Reliability Workbook, chapter 6 (opens in a new tab)
How to measure and rank toil, when not to automate, how to make automation safe, and two long case studies. - Benjamin Treynor Sloss, “Introduction”, Google, Site Reliability Engineering, chapter 1 (opens in a new tab)
Why a written playbook makes on-call faster than "winging it", and the Wheel of Misfortune practice. - Niall Murphy with John Looney and Michael Kacirek, “The Evolution of Automation at Google”, Google, Site Reliability Engineering, chapter 7 (opens in a new tab)
Google's five-step path from no automation to systems that need none, and the Diskerase story. - Dan Slimmon, “Do-nothing scripting: the key to gradual automation” (opens in a new tab)
A short post with a full Python 2 example of a script that only prints each manual step. - PagerDuty Incident Response documentation: Alerting Principles (opens in a new tab)
What every alert must contain, including clear steps or a link to a run book.
Real incident: Amazon Web Services, 28 Feb 2017: AWS S3 outage: one wrong input removed too many servers
Related: Alerting and on-call · Incident response and postmortems · Observability, SLOs and error budgets · Safe deploys and config changes · Working with coding agents
Before this: Alerting and on-call covers which alerts should page and how to run a fair rota.
Related: Incident response covers the team side of an incident, and postmortem action items are a good source of toil to remove. Safe deploys applies the same "go slowly, with limits" idea to changes. Observability and SLOs helps you decide which work actually matters to users.