Back to Terraform

Why Create Before Destroy Does Not Guarantee Zero Downtime

November 6, 2026 Wasil Zafar 33 min read

Connect Terraform replacement order to application compatibility, readiness and traffic cutover

Table of Contents

  1. Replacement Order Is Only One Layer of Availability
  2. Account for Names, Quotas and Double Capacity
  3. Design Blue-Green or Rolling Traffic Changes
  4. Data Migrations Can Make Old Application Versions Unsafe
  5. Measure a Rehearsed Cutover and a Failed Rollout

Replacement Order Is Only One Layer of Availability

At 02:14 the change was correct and the service still dropped requests. The orders-api fleet had create_before_destroy set on both the autoscaling group and the listener rule, the apply finished green in four minutes, and for ninety seconds the new target group answered every request with a 503. The old targets had already been deregistered. The order was right; the service was not ready.

That is not a Terraform bug and not a misconfiguration. The flag did exactly what its name says: for the resource it is declared on, the create call completes before the destroy call starts. Availability is a property of the request path, and the request path never appears in the graph.

create_before_destroy is a statement about two API calls. It removes the window in which no object exists, which is the window people picture when they read "zero downtime". It does not remove the window in which an object exists but cannot serve: a process still booting, a container with no image layers cached, a target registered but not yet passing its health check.

Terraform's unit of knowledge is the resource, not the request. A resource is a record in state plus a set of provider calls. The provider may poll a waiter until the object reports a ready state, and that is still a statement about the object: the load balancer is active, the instance is running, the cluster reports the service exists. None of those mean a request succeeds.

Replacement Order Is Only One Layer of Availability
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    A["Immutable argument changes
or -replace is requested"] --> B["Plan marks the address -/+"] B --> C{"create_before_destroy
on this resource?"} C -->|"no"| D["Destroy, then create
a gap with no object"] C -->|"yes"| E["Create, then destroy
no gap in the graph"] E --> F["Provider create returns
the object exists"] F --> G{"Does the traffic layer
hold a gate?"} G -->|"no"| H["Destroy runs at the end
of the same apply"] G -->|"yes"| I["Gate passes first,
destroy is a later change"] H --> J["Ordered, not available"] I --> K["Available by construction"] classDef primary fill:#132440,color:#ffffff,stroke:#0b172b; classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a; classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f; classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420; classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f; class A,B,C,E,G primary; class F secondary; class K ok; class D,H,J danger;

Read the figure downward and the two outcomes diverge. Both branches end with a new object in state. Only one of them ends with a request that succeeded during the transition, and that branch needed a decision Terraform did not make.

The plan is silent about the interval. A saved plan shows that the replacement is -/+ and which attributes force it. It does not show how long the new object stays unusable, because the plan was created before the object existed and Terraform has no model of the application startup that follows.

Parallelism widens the same gap. Terraform walks the graph with ten workers by default, so any two nodes that share no edge may be applied in either order. If the traffic switch and the new fleet share no edge, nothing in the configuration orders them. Only the reference or the explicit dependency does.

Elapsed time is not a gate either. A sleep resource inserts delay between the create and the destroy, and it observes nothing. It passes in staging with a warm image cache and fails in production on the day the base image is rebuilt.

The three layers are worth separating in a table, because each one is owned by a different system and each fails in a different way.

LayerWho decidesThe signal Terraform seesWhat the signal cannot cover
Graph orderTerraform corePlan edges, dependency references, the -/+ markerAnything that happens after the calls return
Provider completionProvider plus cloud API, including waitersCreate returned without an error, object recorded in stateProcess start, configuration load, dependency reachability
Traffic healthLoad balancer, mesh, or DNSProbe results, error ratio, latency over a windowNothing about the graph, but it is the only layer that sees a request

The bottom row is the only row that answers the question customers ask. "Was the site up?" is a statement about requests. Terraform records objects, so it can answer "did the object exist" and nothing more.

Three layers of a replacement and the promise each one keeps Terraform's graph order promises that the create call precedes the destroy call. The provider promises that the object exists. Only the traffic layer can promise that requests succeed during the transition. Three layers, three different promises 1 — Graph order Terraform core decides that the create node runs before the destroy node. Proves the two calls are ordered. Cannot see any request. 2 — Provider completion The provider and the cloud API decide the object exists, sometimes after a waiter. Proves the create returned cleanly. Cannot see startup or config. 3 — Traffic health The load balancer and the request path decide whether the service is usable. Proves probes pass and errors hold. Cannot see the next request. What each layer leaves out Graph order leaves out time. Provider completion leaves out readiness. Traffic health leaves out everything not on its request path: the queue worker, the cron job, the batch consumer that also lost its old host. The destroy is ordered after the create call, not after the first good request. Everything a customer experiences during the change happens between those two moments, and Terraform records nothing about it.

Restate the claim honestly and it becomes actionable. "Create before destroy removes the destroy-before-create gap" is true. "Create before destroy gives zero downtime" is a claim about a different subsystem, and the next three sections build that subsystem.

The practical consequence is a division of labour. Terraform owns existence and order. The delivery pipeline owns the observation window. The traffic layer owns the switch. A change that skips any of the three is not a zero-downtime change, whatever the flag says.

Account for Names, Quotas and Double Capacity

The second failure mode arrives before any health question. A create-before-destroy replacement needs two objects to exist at once, and many objects are not allowed to exist twice. The apply fails at the create call, with the old object still serving and a half-applied graph behind it.

Uniqueness is the first constraint, and its scope belongs to the API. "Unique" almost never means "unique in this VPC". The scope is a property of the resource type, and getting it wrong is how a plan that looked fine ends at a duplicate-name error.

ObjectWhere the name must be uniqueWhat a second copy needs
Application or network load balancerAccount and regionA different name, or a generated suffix
S3 bucketGlobally across all accountsA globally unused name
Route 53 recordHosted zone, name and record typeA different name; two types may share one name
Security groupVPC, for the name; the group ID is globally uniqueA different name in the same VPC
IAM roleAccountA suffix on the name, since a path does not permit duplicates
KMS aliasAccount and regionA different alias
Kubernetes ServiceNamespace and nameA different name or namespace
Host port bindingOne hostA second host, or a different port

Generated names solve the collision and cost you the identity. A name prefix plus a random suffix lets two objects coexist, and it also breaks every dashboard, runbook, WAF allowlist and alert that referenced the old string. The stable identity has to move somewhere that outlives both objects.

Three patterns own that identity, and they differ in what they cost to operate.

PatternHow identity survivesWhat it costs
Generated suffix plus a stable aliasThe object gets a disposable name; a DNS record, listener rule or service name points at itOne more object to own, and every human-facing reference moves to the alias
Fixed blue and green slotsTwo permanent names; a weighted record or rule selects the live onePermanent double footprint, or a standing cold slot
Separate identity objectAn elastic IP, a DNS name or a service registration outlives the computeWiring the compute to the identity on every replacement

Quotas are the second constraint, and they are counted per account rather than per service. Double capacity is not a percentage of headroom; it is an absolute number of objects the account must be allowed to hold at the same moment.

QuotaWhat doubles during the changeFailure the create returns
On-demand vCPU per regionThe whole new fleet, at full size, before the old one shrinksA vCPU limit error at the first large instance
Elastic IP addresses per regionOne per NAT path or public endpointAn address limit error
Load balancers per regionTwo, while both slots serveA load balancer quota error
Target groups per load balancerOld and new groups, plus canary groupsA target group limit error
Free addresses per subnetA second network interface per instance plus load balancer nodesAn insufficient free addresses error
Database connectionsBoth fleets connected at once, plus migration jobsConnection refused from the database, not from Terraform
Pod or secondary IPs per nodeThe new replica set scheduled before the old drainsPods stuck pending with no obvious plan signal

Plans reserve nothing, so a quota that looks fine can still reject the create. The number of free addresses in a subnet is a live fact, not a plan fact. The same is true of vCPU headroom, elastic IP counts and connection slots. A green plan is a statement that the configuration is valid, not that the account can hold both copies.

Capacity is not only headroom; it is headroom at the same time. Two fleets at 60 percent utilisation each need the account to allow 120 percent of the current footprint. That is a procurement conversation, and it has to happen before the change window rather than during it.

Account for Names, Quotas and Double Capacity
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    A["Replacement proposed
-/+ in the plan"] --> B["Provider create call"] B --> C{"Name unique in
its real scope?"} C -->|"no"| C1["Duplicate name error
old object untouched"] C -->|"yes"| D{"Quota headroom for
a second full copy?"} D -->|"no"| D1["Quota exceeded
apply fails at create"] D -->|"yes"| E{"Subnet, node or database
has room for both?"} E -->|"no"| E1["Address, pod or
connection exhaustion"] E -->|"yes"| F["Replacement recorded
in state"] F --> G["Stable alias repointed
to the new slot"] G --> H["Old object destroy
in a later change"] C1 --> Z["Change stopped,
service still on old"] D1 --> Z E1 --> Z classDef primary fill:#132440,color:#ffffff,stroke:#0b172b; classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a; classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f; classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420; classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f; class A,B,C,D,E primary; class F,G,H secondary; class Z ok; class C1,D1,E1 danger;

Read the failure branches together, because they share a shape. Every one of them stops at the create call, so the old capacity is still there. That is the good outcome: a failed change rather than an outage. The bad outcome is further down, when the create succeeds and something after it fails.

A replacement that fails after the create leaves two objects and one state. The new object is recorded, the old object is still recorded, and the next plan proposes the destroy that the failed apply never reached. Terraform's state model can carry the old object as a deposed entry while the new one takes the address, so a partial replacement is not self-healing: it is a second change waiting for the next person who runs a plan.

Pre-flight checks turn the assumptions into failures you can read. A quota read, a count of existing objects and a subnet capacity check belong in a precondition on the resource that needs the room, because a precondition stops that resource before the provider call. The condition runs at plan time when the values are known, and at apply time when they are not.

Some doubles cannot be created at all. One host cannot bind two listeners to the same port, a single-writer database cannot accept two writers, and a fixed address that clients pin cannot be handed to two fleets. For those objects, blue-green is not a convenience; it is the only shape that works, and the cutover has to be a switch rather than a coexistence.

The capacity conversation is part of the design, not part of the incident. If the answer to "can the account hold two copies" is no, the correct change is a request for an increase, made days earlier, and a note in the runbook that the replacement is blocked until it lands.

Design Blue-Green or Rolling Traffic Changes

A cutover is a sequence of observations, not a sequence of API calls. Each stage asks a question, reads a signal from the system that can answer it, and either advances or stops. The Terraform apply is the first stage and the least informative one.

StageQuestionSignalOwnerAction on failure
ProvisionDoes the new capacity exist?Create returned, instance count reachedTerraformStop, old slot keeps serving
RegisterIs the new capacity in the target group?Target state moves from initial to healthyLoad balancerStop, deregister, keep old
WarmHas it served one real request?Synthetic request with production headers and authPipelineStop, keep old, keep evidence
Shift a sliceDoes the error ratio hold?5xx count over a fixed request budgetPipeline or meshMove the weight back
Shift the restIs the old slot still needed?Zero in-flight requests on the old targetsLoad balancerWait, do not destroy
DestroyHas the soak window closed?Time since the last old-slot requestTerraform, later runAbort the destroy

Readiness is not liveness, and only readiness may move traffic. Liveness asks whether a process should be restarted. Readiness asks whether it can accept a request right now. Wiring the liveness probe into the target group is a common and expensive mistake: a process that is running but has lost its database connection stays in rotation and fails every request.

Readiness probes fail in three predictable ways. They pass too early, before the connection pool and the cache are warm; they pass too late, after the first real request has already timed out; or they never pass, because the probe path was blocked by the same change that deployed the code. The third one is the good failure, because it keeps the old fleet serving.

A warm-up request is stronger than a probe. A probe checks a synthetic path; a warm-up replays a recorded production request with real headers and a real tenant. The difference shows up the first time a new version needs a permission, a feature flag or a downstream certificate that the probe never touched.

Connection draining is a duration, not a flag. The deregistration delay on a target group defaults to five minutes, which is long enough for most request-response traffic and far too short for a report download, a server-sent event stream, a gRPC stream or a WebSocket. The drain must exceed the longest live connection, not the average one.

Long-lived connections need a termination plan. Draining stops new connections; it does not close the old ones politely. A streaming client that holds a connection for an hour will hold it past any reasonable drain, so the design needs either a maximum connection age, a reconnect protocol, or an accepted, measured interruption for that class of client.

DNS TTL is the weakest cutover tool in the box. A TTL is a cache hint: resolvers, operating systems, language runtimes and connection pools each apply their own policy on top of it. Lowering the TTL to sixty seconds an hour before the change reduces the window; it does not close it, and it does nothing for a client that resolved once and holds a pooled connection.

MechanismGranularityRevert speedBlind spot
DNS weighted recordPer resolver cacheTTL plus every cache above itClients that pin, runtimes with their own cache
Listener rule or host headerPer requestSecondsConnections opened before the rule changed
Target group weightsPer requestSecondsIn-flight streams, warm-up state on the new targets
Service mesh or ingressPer requestSeconds to a minuteSidecar config propagation
Two slots and one alias flipWhole serviceSecondsAny path that bypasses the alias

The mechanism you choose decides what a rollback means. A weight change is reversible in seconds and loses nothing. A DNS change is reversible in principle and unpredictable in practice. A destroy is not reversible at all, which is why it belongs at the end and in a separate change.

Where the Terraform boundary ends and the gate begins Terraform owns objects and their order inside one state. The delivery pipeline owns the evidence window and the traffic switch. The traffic plane owns requests and connections. A destroy placed inside the Terraform boundary cannot see any signal from the other two. Three owners, one change Terraform state Creates the new slot orders it before a destroy Records the object and its new identity Destroys the old slot in the same apply Sees: API responses. Never: a request. Delivery pipeline Runs the probe and the warm-up request Reads the error ratio over a request budget Decides to promote or to move the weight back Sees: signals over a window. Holds the abort decision. Traffic plane Weights and rules decide which slot answers Draining closes old connections Nothing here knows about the graph Sees: the request. Owns the real uptime. Terraform's knowledge ends at the API response, at that boundary. A destroy placed inside the left box runs when the apply reaches it, not when the middle box is satisfied. Moving the destroy into a later apply is what gives the gate authority over it. The invariant: healthy serving capacity never falls below the minimum, at any instant of the change.

The boundary is the whole design. If the destroy lives inside the same apply as the create, the gate has no authority: the apply will reach the destroy as soon as the create returns, whatever the pipeline believes. Moving the destroy into a later apply is not a workaround; it is how the gate gets a vote.

Two shapes give that gate authority, and they differ in blast radius. In a two-phase apply, phase one creates and scales up, the pipeline verifies, and phase two removes the old slot in a reviewed plan; the cost is that someone must own that second apply and it must not run automatically on a green pipeline. In a slot-per-root-module design, blue and green are separate states and a small alias state points at the live one; that assumes the alias is the only entry point and no client bypasses it.

A rolling change is the same gate with a smaller step size. An autoscaling group instance refresh or a Kubernetes rolling update replaces capacity in batches, so the invariant is held by a surge and unavailability setting rather than by two slots. Terraform can request the refresh, and the group's preferences carry a minimum healthy percentage and a warm-up period, but that warm-up is a timer rather than an observation: it buys time for a boot, not evidence of a served request.

A blue-green pair is a naming decision before it is a deployment pattern. The slots need names that never change, such as a blue and a green suffix, and the live one is selected by an object that can be flipped: a weighted record, a listener rule, or a service registration. The moment a client is configured with a slot name directly, the pair collapses into two fixed deployments with a manual switch nobody rehearses.

Terraform's own primitives cannot substitute for the gate. A postcondition runs when an object's change completes, a check runs at the end of plan or apply and never blocks, and a destroy provisioner is skipped when create_before_destroy replaces an object. Each is useful for a different claim; none of them observes an error ratio over a window.

A condition that reads a health endpoint is one observation, not a measurement. It can tell you that the endpoint answered once. It cannot tell you that the new fleet held a 99.9 percent success ratio across ten thousand requests while the old fleet drained.

Prove the old capacity outlives the gate by construction, not by hope. Write the invariant down: at every instant of the change, the number of healthy serving replicas is at least the minimum. Then check the plan against it — the only step that can break the invariant is a destroy, and the only destroy in the change is in the second apply, which does not exist until the gate has passed.

Soak longer than the longest connection. The window between "the new slot is serving all traffic" and "the old slot may be destroyed" must exceed the drain plus the longest client connection plus the error budget you are willing to spend on a surprise. Fifteen minutes is a common starting point for request-response services and an hour is not unusual for anything with streaming clients.

Data Migrations Can Make Old Application Versions Unsafe

Infrastructure rollback is a button; data rollback is a restore. That asymmetry is why a blue-green cutover is safe for compute and dangerous for schema. During the overlap, the old and new application versions both run against one database, and any schema change must be safe for both.

Blue-green doubles the compatibility surface. A rollback-only deployment needs the new version to tolerate the old schema. A blue-green deployment needs the old version to tolerate the new schema as well, because the old version keeps serving while the new one is verified — and keeps serving again if the gate fails.

Migration stepOld version still serving?The failure it causes
Add a nullable columnYesNone, provided nothing writes to it yet
Backfill in batchesYesLock contention and replication lag during the batches
Add a column with a default and a not-null ruleUsually yesA table rewrite on some engines, or a default the old code never supplies
Rename a columnNoOld code selects a name that no longer exists
Drop a columnNoOld code selects it and fails at query time
Tighten a constraint or narrow a typeNoOld code writes values the new rule rejects

Expand and contract is the shape that makes the table's first rows true. Expand adds without removing. Migrate dual-writes, backfills and verifies. Contract removes only after the old version is gone, in a later release. The three phases are separate deployments, and the contract is the one that has a point of no return.

The contract release is a different risk class from the expand release. Expand is additive and reversible. Contract deletes a capability that some other process may still depend on: a report, an export, a partner integration that reads the old column directly. The question is not "did we deploy the new version" but "is every reader of the old shape gone".

Dual-write has an ordering problem that is easy to miss. If the old version writes only the old column and the new version writes only the new one, a row's shape depends on which version last touched it. The backfill has to keep running until every row has been written by a version that understands both, and the verification has to compare counts and checksums rather than sample a few rows.

The rollback horizon is the moment the schema change stops being reversible. Before it, reverting the image restores the previous behaviour. After it, the previous image is incompatible with the database it now faces, and the only paths are forward or a restore.

ActionReversible byRough timeWhat is lost
Revert the application imageRedeploy the previous tagMinutesNothing
Move the traffic weight backChange the weightSecondsNothing
Drop an additive columnA new migrationMinutesData written to that column
Undo a destructive migrationRestore or point-in-time recoveryHoursEvery write after the restore point
Restore the databaseRestore plus replayHoursEverything between the recovery point and now

A backup is not a rollback plan. A backup proves that a copy exists. It does not prove that the copy restores in time, that the restored instance has the endpoint the application expects, or that the data between the snapshot and the failure can be reconstructed. Those are rehearsal questions, and they belong in the same runbook as the cutover.

Restoring also changes the connection target. A restored database is usually a new instance with a new address, so the recovery procedure contains its own cutover: application configuration, secrets, DNS or a parameter, and every consumer of the old endpoint. A rollback that takes four hours to restore and another hour to repoint is not the rollback the incident channel assumed.

Expand, migrate, contract, and the point where rollback stops working Expand adds a nullable column so both versions remain safe. Migrate backfills and verifies while both versions run. Contract removes the old shape only after the old version is gone. Reverting the image is cheap before the contract and impossible after it. One schema, two versions, three releases 1 — Expand Add the nullable column and the new index. Old version: safe it never selects it. New version: safe it writes both shapes. 2 — Migrate Backfill in batches and compare counts. Both versions live against one database. Verification decides whether to continue. 3 — Contract Remove what only the old version used. One version left so removal is safe. Separate release with its own review. Point of no return the image can no longer go back Reverting the image is minutes. Reverting a dropped column is a restore. A restore returns the database to its snapshot and discards every write after it. The recovery plan has to name the recovery point, the restore time, and who accepts the loss. Without those three numbers the rollback is a hope.

The practical rule is that no release both deploys code and removes schema. Expand ships with the code that uses the new shape. Contract ships alone, after the old version has been gone long enough that no in-flight request, queued job or retry can still call it. Between them, both versions are valid, which is exactly what blue-green requires.

Feature flags help with behaviour, not with structure. A flag can serve the old code path from the new binary, but it cannot make an old binary read a column that no longer exists. Use flags to decouple release from exposure; use expand and contract to decouple schema from code.

Measure a Rehearsed Cutover and a Failed Rollout

"Zero downtime" is a claim with a denominator, a window and a failure class. Without those three, it is a feeling. The denominator is the requests that arrived during the change, the window is the interval from the first new-target request to the last old-target request, and the failure class is what counts as a failure.

Lab

Assess an availability claim

Execution status: design-only. Terraform CLI 1.17.1 defines the replacement behaviour described here. The measurements below are a rehearsal protocol, not output from a production cutover.

Prerequisites. A staging service with two deployable versions, a target group you can weight, a load generator that can hold a steady request rate, and a dashboard that records per-request outcomes. A second, deliberately broken version is required for the failure half of the exercise.

The claim to test. "Replacing version A with version B caused no downtime." Write it as a numeric statement before you start: the success ratio over the change window, the absolute count of failed requests, and the latency ceiling on the new targets.

MetricDefinitionSuggested gateWhat it catches
Success ratioSuccessful responses divided by requests during the windowAt least 0.999The headline claim
Absolute failuresCount of failed requests, not a percentageZero unexplainedA gap a daily average hides
p99 latencyNew targets compared with old, same request mixWithin twenty percentCold caches and connection storms
Refused connectionsReset or refused at the old targetsZeroA drain shorter than the connections
Time to first healthy targetCreate call to first passing probeUnder the cold-start budgetThe usual real cause of a gap
In-flight at destroyConnections open when the old slot is removedZeroA forced disconnect in the last second

Steps.

  1. Apply the baseline: version A in one slot, all traffic on it, and a load generator at a steady rate for ten minutes. Record the success ratio, the p99 and the connection count as the control.
  2. Create the second slot with version B and leave the weight at zero. Measure the time from the create call returning to the first passing probe. That interval is the cold-start budget the design has to hide.
  3. Move one percent of the weight. Hold it for a request budget large enough to be meaningful — a thousand requests, not a hundred. Record the failures and compare the p99 with the control.
  4. Move all weight to version B with the load generator running. Confirm that the old targets finish their in-flight requests before the deregistration delay expires.
  5. Rehearse the rollback: move the weight back to version A while traffic is still flowing. Record the time from the decision to the first successful response served entirely by A.
  6. Deploy a broken version C that fails its readiness probe, and repeat step 3. Expect the pipeline to abort, the weight to stay at zero, and version A to keep serving without a single failed request.
  7. Destroy the second slot only after the soak window closes, and confirm that the destroy is a separate plan you reviewed rather than the tail of the previous apply.

Expected observation. The successful cutover produces a flat success ratio and a p99 that returns to the control within the warm-up period. The failed rollout produces no change in customer-visible traffic at all, because the gate refused to move the weight. If the failed rollout shows any failures, the gate is measuring the wrong thing.

Failure checks. A cutover that looks clean at one percent and fails at one hundred percent usually has a shared dependency — a connection pool, a licence, a rate limit — that only saturates at full traffic. A rollback that is slower than the forward change usually means the alias, not the fleet, was the thing that changed.

Cost dimensions. Two slots and their load balancer capacity are billable for the duration of the rehearsal, and the load generator adds its own egress and compute. A local file or container-based version of the exercise costs nothing but time.

Cleanup. Destroy the second slot with a reviewed plan, confirm both target groups are empty or gone, and keep the measurement export with the change record. Delete the load generator and any saved plan files.

The denominator trap is the most common way an availability claim survives review. A forty-five second gap at three hundred requests per second is thirteen thousand five hundred failed requests. Averaged across a day it is a rounding error; reported as an absolute count it is an incident. Always report both.

Error budgets make the window comparable to the target. A 99.95 percent monthly objective allows about twenty-two minutes of full outage across thirty days. A three-minute cutover gap is therefore roughly one seventh of the month's entire allowance, spent in one change.

Measure the rollback as carefully as the rollout. The number that matters in the incident channel is the time from "we are reverting" to "old capacity is serving all traffic". A rollback that relies on a fresh apply, a rebuild, or a DNS change has a cost that the forward path never showed you.

The partial rollout is the case worth rehearsing. Many real failures happen after some traffic has already moved: the new slot passes at one percent and collapses at forty. The measurement that matters there is the abort — how many requests fail between the first bad signal and the weight returning to zero — because that interval, not the steady state, is what the error budget pays for.

Instrument before the change, not during it. Dashboards, alarms and the request-rate generator belong in place while the service is healthy. Building them once the errors start is how a small gap becomes a long one.

The final test is a failed rollout, not a successful one. A gate that has never refused a bad version is a hypothesis. Deploy the broken version on purpose, confirm that the old capacity keeps every request, and record the evidence — that record is the only proof that the availability claim was ever true.

The flag buys order; the gate buys the claim. create_before_destroy earned the right to replace an object without a gap. It did not earn the right to say the service stayed up. That sentence belongs to the drain, the weights and the compatibility matrix, and only a rehearsed failure proves the gate was ever real.