liveBook · Manning

Canary deployment

As explained in Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform

A canary deployment is a release pattern that incrementally exposes a change to a limited portion of users, traffic, or infrastructure before expanding it broadly.

A canary deployment sends a small percentage of traffic to updated resources before expanding exposure. Successful requests justify increasing the percentage; errors trigger debugging and a return to the previous environment. section 9.2.3

Apply the pattern as a controlled rollout:

  • Prepare updated green resources alongside the existing blue resources. section 9.2.3
  • Route a limited share of requests to green, such as 10% green and 90% blue. section 9.2.3
  • Observe errors and functionality, then increase green traffic gradually when results remain acceptable. section 9.2.4
  • Reduce green traffic and debug when failures appear; retain blue until the regression window provides confidence. section 9.2.4

Canarying a database change

For stateful infrastructure, applications first write to both blue and green databases, then write exclusively to green, and finally read from green. Automation may reconcile duplicated data, while incremental rollout preserves a route back to blue. section 9.3.3

Figure 9.7 Configure the global load balancer to run a canary test and send a small percentage of traffic to green resources.

Shows a global load balancer sending a small traffic percentage to green resources during a canary test. section 9.2.3

How Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform covers it

How deep it goes
Explains traffic weighting, rollback, monitoring, regression windows, and stateful cutover, but leaves increment selection context-dependent.
Examples
Uses blue-green networks, weighted load-balancer services, application instances, and staged database writes and reads.
What it assumes
Assumes parallel blue and green resources plus a mechanism for directing traffic between them.
What you can do after
Operate/configure incremental traffic shifts, monitor regressions, and revert to the previous environment when failures emerge.
How it connects
Connects canary deployment with blue-green deployment, regression testing, load balancing, infrastructure as code, and database migration.

Also explained in

Compare how 7 books explain canary deployment →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform. The section links point to the parts of the book it draws on.