Skip to main content
In this lesson we explain the difference between immutable and mutable deployments — a core concept for deployment strategies and a frequent topic on the AWS Certified DevOps Engineer - Professional exam. A simple analogy helps:
  • Immutable: build a brand-new house with all updates, move in, and demolish or sell the old house — no dust, no live disruption.
  • Mutable: renovate the existing house while people live in it — occupants see changes as they happen and may experience interruptions.
These two models map directly to how you update servers, containers, or serverless functions.

Mutable deployments

Mutable deployments modify existing systems in place. Typical workflows include SSH/SSM access, running configuration management, or applying patches directly on the running instance.
A diagram titled "Mutable Deployments" showing a developer using SSH, SSM and configuration management tools to access a running server hosting App(v1). A downward arrow indicates the server being updated to App(v2).
Common mutable update activities:
  • In-place OS or package updates (patch management).
  • Live configuration changes using Chef, Puppet, Ansible, or similar.
  • Manual SSH/SSM changes for emergency fixes.
Advantages and drawbacks:
  • Pros: fast for small, targeted changes; minimal short-term resource use.
  • Cons: risk of configuration drift, state divergence between hosts, more complex rollback and debugging, and a weaker security posture over time.

Immutable deployments

Immutable deployments avoid changing running instances. Instead you build a new artifact (VM image, container image, Lambda version), deploy the new instances, shift traffic, and terminate or retain the old instances as a rollback target. This prevents in-place drift and ensures reproducible environments.
A slide titled "Immutable vs Mutable Deployments" showing a table that compares update method, state management, rollback, and tools used for each approach. It notes mutable deployments change existing instances and risk drift, while immutable deployments create new instances for consistent, repeatable updates and simpler rollbacks.
Immutable patterns usually require traffic shifting (blue/green, canary, weighted routing) but reduce drift and make rollbacks simple—switch traffic back to the prior version.

Key properties and tooling

A presentation slide titled "Advantages" comparing Mutable Deployments (left) and Immutable Deployments (right). Each column lists benefits — e.g., faster/targeted changes and reduced duplication for mutable, and consistent templates, no configuration drift, easy rollback, and fresh systems for immutable.

AWS-specific immutable examples

  • AMI-based pipeline: bake an AMI (e.g., via EC2 Image Builder), launch from that AMI using Auto Scaling or CloudFormation, then replace the old fleet.
  • Blue/Green: run two complete environments (blue and green) and flip traffic between them (Elastic Beanstalk supports this).
  • Canary / Weighted routing: shift a percentage of traffic to the new version and increase based on telemetry (Route 53 weighted routing, ALB target groups, API Gateway).
  • Lambda versions and aliases: route a percentage of traffic to a new Lambda version and then move the remainder once validated; can be orchestrated via CodeDeploy.
Below is an example of weighted traffic shifting (canary) between environments.
A diagram of an immutable blue/green deployment showing Amazon Route 53 splitting traffic (90%/10%) between an existing and a new Elastic Beanstalk environment. Each environment includes Elastic Load Balancing in front of EC2 instances.
Benefits of blue/green and canary approaches:
  • Instant rollback by switching traffic back.
  • Minimal user disruption on cutover.
  • Safer validation because production traffic can be used for testing with a controlled blast radius.
A slide titled "Immutable Deployments – Blue/Green Deployment – Benefits" showing three numbered cards with icons. The cards list: 01 Instant rollback to previous version, 02 Minimal user disruption, and 03 Safer testing in real-world traffic.

Lambda and traffic shifting

Lambda supports versioning and aliases, which let you route a percentage of invocation traffic to a new version and then move the remainder after validation. API Gateway and CodeDeploy provide orchestration for automated canary or linear traffic shifts.
A slide titled "Immutable Deployments – Lambda Versions" showing an Amazon API Gateway icon routing 0% traffic to a Lambda Function v1 and 100% traffic to Lambda Function v2. The diagram illustrates traffic shifting between immutable Lambda versions.

Common immutable deployment patterns

  • AMI-based: bake machine images and replace instances (EC2 Image Builder, Auto Scaling, CodeDeploy).
  • Blue/Green: run two complete environments and flip traffic (Elastic Beanstalk, ECS, ALB, Route 53).
  • Canary / Weighted deployments: incrementally shift traffic (Route 53 weighted routing, ALB, API Gateway).
  • Lambda versioning: control traffic using versions/aliases (CodeDeploy for automated strategies).
A slide titled "Types of Immutable Deployments" showing a three-column table of deployment types, brief descriptions, and common tools. Examples listed include AMI-based, Blue/Green, Canary, and Lambda versions with tools like EC2 Image Builder, Auto Scaling, CodeDeploy, ALB, ECS, and Route 53.

Summary — trade-offs and when to choose each

A presentation slide titled "Conclusion" that shows a color-coded comparison table of factors for a Mutable Approach versus an Immutable Approach. The table compares items like deployment speed, resource usage, configuration drift, rollback reliability, security, debugging, and infrastructure-as-code.
Recommendation
For production systems, prefer immutable deployment patterns (containers, Lambda versions, AMI baking + Auto Scaling or blue/green) to minimize configuration drift and simplify rollback. Use mutable approaches selectively when you need very small, rapid changes and can tolerate higher operational risk.

References and further reading

Watch Video