Comparing Deployment Strategies
Every deployment strategy balances speed, cost, risk and complexity differently. This lesson defines the strategies the exam uses, explains how each one behaves during a deployment and during a rollback, and describes how to choose a strategy from a scenario's requirements, including the special care needed for database changes and stateful applications.
Learning outcomes
After completing this lesson, you will be able to:
- Define the all-at-once, rolling, rolling with additional batch, immutable, blue/green, canary and linear strategies.
- Compare the strategies by capacity, deployment time, rollback speed, cost and user impact.
- Choose a deployment strategy that meets a scenario's requirements.
- Explain how database schema changes and session state constrain deployment strategies.
- Distinguish mutable from immutable deployments and explain how Amazon EBS, Amazon EFS and Amazon S3 storage affects them.
The Strategies
The following definitions are used consistently across AWS services, although each service names its options slightly differently.
All at once
Every target is updated at the same time. It is the fastest strategy and needs no extra capacity, but the application is unavailable or degraded while targets restart, and a faulty version affects every user at once. Rollback means another full deployment. It suits development and test environments.
Rolling
Targets are updated in batches, so part of the fleet keeps serving while each batch is updated. Capacity is reduced by one batch during the deployment, and old and new versions serve traffic at the same time, which the application must tolerate. Rollback is another rolling deployment of the previous version.
Rolling with additional batch
Like rolling, but a new batch of targets is launched first, so capacity never falls below 100%. It costs slightly more than rolling for the duration of the deployment.
Immutable
New targets are launched with the new version in a separate group, verified, and then moved into service, after which the old targets are terminated. Existing targets are never modified, so a failed deployment simply terminates the new targets and leaves the old ones untouched. It is slower and needs double capacity temporarily.
Blue/green
A complete second environment (green) is created alongside the current one (blue). Traffic is switched from blue to green, all at once or gradually, by a load balancer, DNS or an alias. Blue is kept for a period so that rollback is an immediate switch back. It gives the fastest and safest rollback at the cost of running two environments.
Canary
A small percentage of traffic is sent to the new version for an evaluation period while monitoring detects problems; if none are found, the rest of the traffic follows. Canary releases limit the number of users exposed to a faulty version and are usually implemented on top of blue/green infrastructure or weighted routing.
Linear
Traffic shifts in equal increments at regular intervals, such as 10% every 3 minutes. It exposes users progressively and gives several observation points, at the cost of a longer deployment.
Two related techniques also appear in scenarios. A/B testing sends different users to different versions to compare business outcomes, which is a product experiment rather than a safety mechanism. Shadow or dark traffic copies production requests to the new version without returning its responses to users, to test behaviour under real load.
Comparing the Strategies
The table below compares the strategies on the dimensions that exam scenarios usually emphasise: capacity during deployment, user impact of a faulty version, rollback speed and extra cost.
| Strategy | Capacity during deployment | Impact of a faulty version | Rollback | Extra cost |
|---|---|---|---|---|
| All at once | Downtime or reduced | All users | Slow (redeploy) | None |
| Rolling | Reduced by one batch | Growing share of users | Slow (redeploy) | None |
| Rolling with additional batch | Full | Growing share of users | Slow (redeploy) | One batch |
| Immutable | Full | Limited until moved into service | Fast (terminate new targets) | Double, temporarily |
| Blue/green | Full | All users after the switch, unless shifted gradually | Immediate (switch back) | Double, temporarily |
| Canary | Full | Canary percentage only | Immediate | Depends on the platform |
| Linear | Full | Increasing percentage | Immediate | Depends on the platform |
The following diagram compares the capacity each strategy uses during a deployment.

Reading strategy requirements
Match the strategy to the decisive requirement. "No downtime and lowest cost" points to rolling. "Full capacity at all times" points to rolling with additional batch or immutable. "Fastest possible rollback" points to blue/green. "Minimise the number of users affected by a bad release" points to canary. "Lowest deployment time in a test environment" points to all at once.
Name the strategy
Databases and Schema Changes
Strategies that run old and new versions at the same time (rolling, canary, linear and blue/green with a shared database) require that both versions work with the same database schema. A change that renames a column breaks the old version as soon as the migration runs. The expand and contract pattern, also called parallel change, avoids this. In the expand phase, the schema change is additive: a new column is added and the new version writes to both columns. After every instance runs the new version, data is backfilled. In the contract phase, a later release removes the old column. Each step is backwards compatible with the version before it, so any step can be rolled back.
Blue/green deployments with separate databases avoid shared-schema problems but introduce data synchronisation problems: writes to the blue database after the switch would be lost on rollback. For this reason, most blue/green deployments on AWS switch the compute layer and share the data layer, relying on backwards-compatible schema changes.
Expand and contract
Session State and Long-Lived Connections
If user sessions are stored in an instance's memory, replacing the instance logs users out, and sticky sessions on a load balancer keep users on old instances, which slows traffic shifting. Storing session state externally, in Amazon ElastiCache or Amazon DynamoDB, makes instances stateless so that any strategy can replace them freely. Load balancer deregistration delay (connection draining) lets in-flight requests finish before an instance is removed; for long-lived connections such as WebSockets, the delay must be long enough or clients must reconnect gracefully.
Application Storage in Mutable and Immutable Deployments
The strategies fall into two families. Mutable deployments (all at once, rolling and in-place CodeDeploy deployments) change the software on servers that already exist, so anything stored on those servers survives the release. Immutable deployments (immutable, blue/green, and instance or task replacement) never modify a running server; they launch new ones from a new image and discard the old ones, so anything stored only on the old servers is lost. Immutable deployments are more predictable, because every server is built from the same image and cannot drift, and rollback means returning to servers that were never touched. Their condition is that the application keeps no data it needs on the server itself. Where the data lives therefore decides which family a workload can use.
Amazon EBS volumes are block storage attached to one instance in one Availability Zone. The root volume of an instance in an Auto Scaling group is normally deleted when the instance is terminated, so files written there, such as uploaded images or a local cache, disappear in an immutable deployment, and an additional data volume would have to be detached and reattached or restored from a snapshot. EBS suits operating system and application files that come from the image and can be recreated. Instance store volumes are lost even when an instance stops, so they suit only temporary data.
Amazon EFS is a shared file system that many instances, ECS tasks, EKS pods and Lambda functions in several Availability Zones can mount at once. Because it exists independently of any server, data written by the old version is immediately available to the new version, which makes EFS the usual answer when an application that expects a file system, such as a content management system, must be deployed immutably. Amazon S3 is object storage accessed through an API rather than a mount, and it is the preferred home for user uploads, static assets, logs and deployment artifacts: it is durable across Availability Zones, independent of compute and readable by every version during a blue/green switch. Combined with session state in ElastiCache or DynamoDB and records in a managed database, these choices make the compute layer stateless and therefore safe to replace.
Lost files after deployments
If a scenario reports that files uploaded by users disappear after each deployment or scaling event, the application is storing them on instance volumes. Move them to S3, or to EFS when the application needs a shared file system, rather than changing the deployment strategy.
Selecting Strategies for Three Workloads
An organisation asks for a deployment strategy for three workloads with different priorities.
| Workload | Decisive requirement | Strategy | Reason |
|---|---|---|---|
| Internal reporting tool on four EC2 instances | Lowest cost; brief reduced capacity acceptable | Rolling | No extra instances and no downtime |
| Customer checkout API on Lambda | Fewest customers affected by a faulty release | Canary with alarm rollback | Only the canary share is exposed during evaluation |
| Trading platform on EC2 | Immediate rollback and full capacity | Blue/green | Switching back to blue takes seconds |
A team wants to rename a database column used by an application deployed with rolling updates. What approach avoids errors while old and new versions run together?
Show answer
Expand and contract: add the new column and write to both in one release, backfill, switch reads, and remove the old column in a later release, so every step is compatible with the running versions.
Exam Tips
Remember for the exam
- Rolling keeps service up at no extra cost but reduces capacity; rolling with additional batch keeps full capacity; immutable and blue/green need temporary double capacity.
- Blue/green offers the fastest rollback; canary minimises the users exposed to a faulty version; all at once is fastest but causes downtime.
- Strategies that run two versions together need backwards-compatible schema changes (expand and contract).
- Externalise session state (ElastiCache or DynamoDB) so instances can be replaced freely.
- Immutable deployments discard instance storage; keep shared files on EFS and uploads, assets and artifacts in S3.