Let’s Get Certified
Module 05 / 20 · Delivery automation

Limit exposure during a deployment

Compare traffic shifting, compatibility and rollback evidence for Lambda, ECS and EC2.

Limit exposure during a deployment

A Lambda alias can shift a fraction of traffic between published versions. An ECS blue/green deployment keeps distinct task sets and validates the replacement before transferring traffic. In-place EC2 updates conserve capacity but require enough healthy instances to serve while a batch is unavailable.

Define a minimum sample, observation interval and error or latency threshold for the candidate version. If it receives 100 calls and fails 10, a regional error rate over 100,000 calls can hide the regression. Keep the prior version ready. When releases change a database schema, stage compatible changes so both old and new binaries can serve during rollout and rollback.

Worked case 1

A candidate fails 12 of 200 calls while stable fails 3 of 10,000. The fleet alarm is green. Should rollout continue?

Check your reasoning

Inspect error rates by version. The candidate is at 6% and stable at 0.03%. Stop or roll back under a 2% gate once the sample requirement is met.

Worked case 2

Routing went back to blue but blue can no longer read the database. What was missing?

Check your reasoning

A compatible schema transition. Add and populate new fields first, support both application versions and remove old fields only after rollback is no longer needed.

Run a local canary gate

Predict which candidate should wait, proceed or return traffic to stable. The policy requires 100 observations, an absolute failure rate below 2%, and at most one percentage point above stable. Run this locally with Python 3.

stable_failures, stable_calls = 3, 10000
stable = stable_failures / stable_calls
for name, failures, calls in [("early", 0, 40), ("normal", 1, 200), ("regression", 12, 200)]:
    rate = failures / calls
    if calls < 100:
        action = "HOLD"
    elif rate >= 0.02 or rate - stable > 0.01:
        action = "ROLL BACK"
    else:
        action = "PROMOTE"
    print(f"{name}: {failures}/{calls} ({rate:.1%}) -> {action}")
Check your output
early: 0/40 (0.0%) -> HOLD
normal: 1/200 (0.5%) -> PROMOTE
regression: 12/200 (6.0%) -> ROLL BACK

The first cohort lacks sufficient evidence. Normal traffic stays within both limits. The regression exceeds both. Set normal failures to 3 to see the relative guardrail fail even below the absolute limit.

Automating safe deployments at Amazon

Official DOP-C02 skills for this topic

AWS re:Invent — Hands-off automated delivery pipelines

Related lesson in AWS Certified Developer – Associate. Release with a measurable rollback condition.

Practice with the recording

The replacement container tasks are healthy, but transactions fail only when routed to the new revision. Should traffic keep moving?

Check your reasoning

Pause the shift and compare candidate transaction failures with the baseline. A healthy task can still return incorrect responses. Set a rollback alarm on the user operation and retain the prior task set long enough to serve traffic again.

sthithapragna · DOP-C02 full course · 1:34:00

Knowledge check

Limit exposure during a deployment quiz

Answer 3 questions. Check each answer for an explanation.

Worked example · Release decision