Reliability and security · L1Safe deploys and config changes

Safe deploys and config changes

Most outages start with a change. Learn to ship code and config in small, watched steps, and to undo them fast.

L1 Must-knowReliability and security15 min read
Fact-checked by AI against cited sources · Human review pendingLast reviewed 21 Oct 2026 · How we check content
Senior at work · lesson 7 of 26
Section 1 of 8

What broke

On 2 July 2019 at 13:42 UTC, a Cloudflare engineer deployed a small change to a firewall rule. The rule was meant to catch cross-site scripting attacks. It had passed its automatic tests. 1

Within seconds the rule was on every Cloudflare server in the world. It contained a regular expression that backtracked badly. CPU use on the servers that handle web traffic jumped to nearly 100%. Visitors to Cloudflare sites got 502 errors, and Cloudflare lost about 80% of its traffic. 1

The rule was in "simulate" mode, so it was not meant to block anything. But even in that mode the rule still had to run, and running it was the problem. 1

Why did one rule reach everyone at once? Normal Cloudflare code went through staged rollouts. Firewall rules did not, by design, so that the team could respond fast to new attacks. 1

At 14:07 the team used a "global terminate" to switch off the firewall everywhere. Traffic came back at 14:09. One of the fixes they listed was to move rule changes to staged rollouts, like code. 1

Section 2 of 8

The idea in simple words

Most outages do not start on their own. They start with a change. Google's SRE team writes that, in its experience, most incidents are triggered by binary or configuration pushes. 4

The key idea. Config is code. It changes how running systems behave, so it needs the same checks, the same slow rollout and the same fast undo as code.

A safe deploy has three parts:

  1. Check before you ship. Validate the change before it reaches any real server.
  2. Ship to a few first. Send the change to a small group, watch it, then go wider in steps.
  3. Undo fast. Make rollback one click or fully automatic, and practise it.

The goal is a small blast radius. If a change is bad, only a few users should see it, and only for a few minutes.

Section 3 of 8

How it works

Step through a bad config change. Path A pushes it everywhere at once. Path B uses a staged rollout. Use Next and Back, or the ← and → keys.

Global push vs staged rollout: the bad config is caught at the canaryConfig v42 (bad) Region 1Region 2Region 3Region 4A · global push, in seconds every region fails at once B · validate: format, size, speed testpasses: bug shows only on real trafficCanary1%Wave 110%Wave 250%Wave 3100% Canary1%errors upCPU 100% waves never get v42auto rollback✓ Caught at 1%, undone in minutes SeniorPath
  1. Path A, a global push. A new config passes its tests. The config system sends it to every server in every region within seconds.
  2. The config has a hidden bug that uses all the CPU. Every region fails at the same time, so every user is hit.
  3. Path B, a staged rollout. First, a machine validates the file: format, size and a quick speed test. Some bugs show up only on real traffic, so assume a few will pass.
  4. The config goes to the canary first: 1% of servers. During bake time, health checks compare the canary with the rest. Errors and CPU jump.
  5. The health check fails, so the system rolls the canary back and stops the rollout. The other 99% never got the bad config. A few users saw errors for minutes, not the whole world.
Step 1 of 5

Now try it yourself. Push the same bad change both ways, and change how fast alerts notice.

Try it: push a bad config everywhere, or in stages

Validate the change first

Before any rollout, a machine should check the change. Does the file parse? Does it match the schema? Is it a normal size? Does a quick test on sample traffic stay fast? After the outage, Cloudflare planned speed tests for every firewall rule. It also planned to switch to a regex engine with run-time guarantees. 1

Validation catches simple mistakes. It does not catch every bug, so you still need the next steps.

Canary, then waves

A canary is a small part of the fleet that gets the change first. The rest of the fleet is the control. You compare the two: error rate, latency, CPU. 4

If the canary looks healthy, you go wider in waves. AWS describes a real pipeline: first one box in one zone, then one region, then groups of regions that get bigger each time. 3 In the first wave, AWS deploys to only one Availability Zone at a time. An Availability Zone is one of several separate locations inside an AWS region. Its top goal is to never hurt more than one region at once. 3

A simple percentage rollout follows the same idea: 1%, then 10%, then 50%, then 100% of servers or users.

Bake time and health checks

Bake time is how long you wait at each stage before going wider. Some bugs need time or real traffic to show up. The AWS pipeline waits at least one hour after each one-box stage. It waits at least 12 hours after the first wave of regions. 3

During bake time, automated health checks watch the metrics. If an alarm fires, the system rolls back on its own. No human has to wake up and decide. 3

Feature flags and kill switches

A feature flag lets you turn code on or off without a new deploy. 5 Ship new code switched off, then turn it on for 1% of users, then more. If it breaks, turn it off in seconds.

Flags also act as kill switches. On 29 May 2025, Google Cloud added new quota-checking code with no feature flag and no proper error handling. Nothing used it until 12 June. Then a policy with blank fields spread to every region within seconds. The code crashed on it. The team needed about 40 minutes to finish rolling out its "red button" fix. 2 Afterwards, Google said changes to critical binaries must be behind a flag that is off by default. It also said policy data must roll out in steps, with time to check each step. 2

Flags have a cost. Each one adds a branch to test. Remove a flag once the feature is fully on. 5

Section 4 of 8

Trade-offs

ApproachSmall blast radius?Speed to reach everyoneUse it when
Global pushNo Every user at once.Seconds.A real emergency, like an active attack, and you accept the risk.
Canary, then wavesYes A small group sees a bad change first.Hours to days.Most code and config changes.
Percentage rollout behind a flagYes You choose the share of users.Minutes to days, your choice.New features and risky code paths.
Blue-green (two full copies, switch traffic)No All traffic moves at once.Minutes.You need a very fast undo, and you can pay for two copies.

Simple rule: keep a fast global path only for emergencies, and make the slow staged path the default. Cloudflare's planned fix did the same: staged rollouts for rule changes, and a global push kept only for active attacks. 1

Section 5 of 8

At work: how a senior uses this

  • Ask about every change: "How do we undo this, and how long does it take?" If nobody knows, the change is not ready.
  • Treat config, feature flags, firewall rules and data files as code. They need review, validation and a staged rollout.
  • Ask "what is the blast radius?" A change that touches every region at once needs a very good reason.
  • Name the metric that decides go or no-go before you deploy. Write it in the change ticket, for example "5xx rate above 0.5% on the canary means rollback".
  • Make rollback automatic where you can. Test it on a normal day, not for the first time during an outage.
  • Check that the tools you use to roll back do not depend on the system you are deploying. During the 2019 outage, Cloudflare engineers had trouble reaching internal tools. 1
  • Ship big changes as many small ones. A small change is easier to check and easier to undo.
Section 6 of 8

With AI

What to ask the agent

"Here is our deploy pipeline config. List every way a change can reach all production servers at once, including config and feature flags."

"Write a validation script for this config file. Check the schema, the size limits and the allowed values. Fail the build if any check fails."

"Add a canary stage to this pipeline: deploy to 1% of hosts, wait 30 minutes, and roll back if the 5xx rate or p99 latency rises."

What to check yourself

  • The canary gets real traffic, and enough of it to show a problem.
  • The rollback trigger uses metrics you trust, with clear thresholds.
  • Rollback was tested, and it works when the new version is crashing.
  • Config and data files go through the same stages as code, not a side path.
  • New flags are off by default, and each has an owner and a plan to remove it.
Section 7 of 8

Check yourself

1. Your team changes one line in a shared config file. How should it reach production?

Show answer

Validate it, then roll it out in stages with health checks, like code. Config changes the behaviour of running systems, so they cause outages too. Treat them like code.

2. The canary runs the new version on 1% of servers. Its error rate doubles. What should happen first?

Show answer

Roll back the canary and stop the rollout. Mitigate first, debug second. A fast rollback limits harm, and you can study the logs afterwards.

3. What does bake time mean?

Show answer

Time you wait at each stage, watching metrics, before you go wider. Some bugs show up only after minutes or hours of real traffic. Bake time gives them a chance to appear.

4. In the 2019 Cloudflare outage, why did one bad rule hit every server?

Show answer

Firewall rule changes were allowed to go global in seconds, with no staged rollout. Code went through staged rollouts, but WAF rules were pushed globally so they could stop new attacks quickly.

Your progress is saved only in this browser. Export it to keep it safe.

Was this clear?
Report a mistake (opens GitHub in a new tab)
Section 8 of 8

Go deeper

Show 5 sources and related lessons
  1. Cloudflare, “Details of the Cloudflare outage on July 2, 2019” (official postmortem) (opens in a new tab)
    The full timeline, why WAF rules skipped the staged rollout, and the list of fixes.
  2. Google Cloud, Service Health incident report for 12 June 2025 (official) (opens in a new tab)
    How code with no feature flag met policy data that spread to every region in seconds.
  3. Clare Liguori, “Automating safe, hands-off deployments”, Amazon Builders' Library (opens in a new tab)
    A real pipeline with one-box stages, waves of regions, bake times and automatic rollback.
  4. Google, The Site Reliability Workbook (O'Reilly), chapter “Canarying Releases” (opens in a new tab)
    What a canary is, how to compare it with the rest of the fleet, and why config changes need it too.
  5. Pete Hodgson, “Feature Toggles (aka Feature Flags)”, martinfowler.com (opens in a new tab)
    The kinds of feature flags, and why every flag has a cost until you remove it.

Real incident: Cloudflare, 2 Jul 2019: Cloudflare outage: one regex used all the CPU

Real incident: Google Cloud, 12 Jun 2025: Google Cloud outage: blank policy fields crashed API checks

Real incident: CrowdStrike, 19 Jul 2024: CrowdStrike outage: a content update crashed Windows hosts

Real incident: Cloudflare, 18 Nov 2025: Cloudflare outage: a feature file grew too big

Real incident: Cloudflare, 5 Dec 2025: Cloudflare outage: a global config change hit an old bug

Related: Feature flags and entitlements · CI/CD and trunk-based development · Observability, SLOs and error budgets · Incident response and postmortems

Related lessons: Feature flags, CI/CD and Incident response.

Term

See full entry

Jump to a section

  1. 1What broke
  2. 2The idea in simple words
  3. 3How it works
  4. 4Trade-offs
  5. 5At work
  6. 6With AI
  7. 7Check yourself
  8. 8Go deeper