# Immutable Infrastructure

Immutable infrastructure is an operating model in which deployed compute resources are replaced with newly built, versioned resources rather than modified in place.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/immutable-infrastructure

> Changes to operating systems, application dependencies, and security configuration are built into tested machine or container images and deployed as replacements. This reduces configuration drift and makes recovery more repeatable, provided that persistent data, secrets, and incident evidence are managed separately.

Practice exams covering Immutable Infrastructure: [SOA-C03 AWS Certified CloudOps Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-cloudops-engineer-associate), [DVA-C02 AWS Certified Developer - Associate](https://blowstack.com/practice-exams/aws-certified-developer-associate), [DOP-C02 AWS Certified DevOps Engineer - Professional](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional), [MLA-C02 (beta) AWS Certified Machine Learning Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate), [SCS-C03 AWS Certified Security - Specialty](https://blowstack.com/practice-exams/aws-certified-security-specialty), [SAA-C03 AWS Certified Solutions Architect - Associate](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate), [SAP-C03 AWS Certified Solutions Architect - Professional](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional).

## 6 key aspects of Immutable Infrastructure

Immutable infrastructure combines trusted image builds, replacement-based deployment, externalized state, and evidence-aware recovery to reduce drift and make compute workloads reproducible.

1. **Replace rather than modify**: Deliver software and configuration changes through newly built resources instead of routine in-place edits. Restrict interactive production changes and reconcile any emergency exceptions into the approved build.
2. **Versioned, trusted artifacts**: Identify approved machine images and container images explicitly, using AMI IDs or container digests as appropriate. Protect build pipelines and artifact publishing permissions so that a repeatable deployment does not repeatedly deploy a compromised artifact.
3. **Security built into the baseline**: Apply operating system hardening, dependency updates, logging agents, and security tooling during image creation. Validate both image contents and the deployment-time permissions, connectivity, and runtime settings needed for those controls to function.
4. **Controlled replacement and recovery**: Use staged deployment, health checks, and sufficient capacity to replace resources safely. Retain approved versions for recovery, but verify security fixes and data compatibility before rolling back.
5. **Separation of state and secrets**: Keep durable application data outside disposable compute and protect it with independently tested backups. Retrieve secrets at runtime rather than baking credentials into images.
6. **Evidence-aware incident response**: Contain suspected workloads and preserve required evidence before replacement destroys it. Rebuild from a trusted baseline, address the initial compromise, and remediate exposed credentials and affected external state.

## Cloud services for Immutable Infrastructure

EC2 Image Builder produces tested machine and container baselines, while Amazon ECR stores container artifacts for deployment. EC2 Auto Scaling replaces virtual machines using approved AMIs, and Amazon ECS replaces container tasks using updated task definitions. Systems Manager provides operational visibility and controlled automation without making routine production edits the deployment model. AWS Backup protects supported persistent resources that must survive compute replacement. Together, these services support rebuilding workloads from trusted artifacts while keeping state recoverable. Incident workflows must additionally coordinate containment, evidence preservation, credential remediation, and validation before returning replacement workloads to service.

- **[EC2 Image Builder](https://blowstack.com/tools/cloud-services-hub/ec2-image-builder)**: Automates the creation, testing, and distribution of AMIs and container images using defined recipes and components. Use it to build patched, hardened baselines rather than manually maintaining production hosts.
- **[Amazon EC2 Auto Scaling](https://blowstack.com/tools/cloud-services-hub/amazon-ec2-auto-scaling)**: Replaces EC2 instances using launch template configurations that reference approved AMIs. Instance refresh supports rolling a fleet onto a new image; incident procedures should account for automatic replacement before isolating or preserving affected instances.
- **[AWS Systems Manager](https://blowstack.com/tools/cloud-services-hub/aws-systems-manager)**: Supports inventory, managed access, and automated operational or response workflows for instances configured with the necessary agent, permissions, and connectivity. Use it to inspect and orchestrate workloads while keeping routine patch delivery in the image rebuild-and-replace process.
- **[AWS Backup](https://blowstack.com/tools/cloud-services-hub/aws-backup)**: Provides policy-based backup and restore capabilities for supported persistent resources. It complements disposable compute by protecting state, but recovery procedures must still validate recovery points and avoid restoring compromised data.

## Immutable Infrastructure exam questions

Real practice exam questions on Immutable Infrastructure, with the correct answer and its explanation.

### Question 1 (MLA-C02 (beta))

**Question:**

A company runs GPU-based PyTorch inference on Amazon EKS. Its application image extends an AWS-provided framework image with a custom preprocessing package and is stored in private Amazon ECR. A security review identifies a vulnerable CUDA user-space library inherited from the base image. AWS has published a replacement base image that fixes the vulnerability and supports the company's approved PyTorch version and GPU instances. The company requires tested, reproducible releases and rollback to the exact previous application image. Which solution meets these requirements with the least dependency-maintenance effort?

**Correct answer:** Update the Dockerfile to reference the patched GPU inference AWS Deep Learning Container by digest. Rebuild the application image with pinned custom dependencies, test it, and push it to Amazon ECR. Deploy the new application image by digest and retain the previous digest for rollback.

**Explanation:** AWS Deep Learning Containers provide preconfigured framework and accelerator libraries, reducing the need to assemble and maintain that stack. Rebuilding from the compatible patched base incorporates the library fix into the application image. Pinned dependencies, testing, digest-based deployment, and retention of the previous image provide reproducibility and exact rollback.

### Question 2 (SOA-C03)

**Question:**

A company runs an Amazon ECS service on EC2 container instances. EC2 Image Builder produces the host AMI, and Amazon ECR stores the application's container image. A security assessment identifies a vulnerable Linux kernel on the hosts and a vulnerable application library in the container image.

The company requires both vulnerabilities to be remediated. All operating system and application software changes must pass testing before reaching production. Production hosts and running containers must not have software installed or updated in place. Sufficient capacity is available to drain workloads during replacement.

Which remediation plan meets these requirements?

**Correct answer:** Build and test a replacement host AMI with the updated kernel and a replacement container image with the updated library. Update the fleet's launch configuration to use the new AMI, drain and replace the existing hosts, and deploy replacement tasks that reference the tested container image digest.

**Explanation:** The host AMI controls the host kernel, while the container image controls the application's library. Testing both replacement images and replacing the hosts and tasks remediates both layers without modifying production software in place. Referencing the tested container image digest identifies the exact approved artifact.

### Question 3 (SCS-C03)

**Question:**

A company stores container images in private Amazon ECR repositories. A security-controlled build pipeline applies the required hardening configuration and runs security tests. Developers can also push images to these repositories, so the presence of an image in a repository does not establish that it passed the approved build process.

The security team wants cryptographic evidence that each production image passed the security-controlled pipeline and has not changed since approval. The production deployment pipeline is centrally managed, and developers cannot modify or bypass its checks. Images that lack valid evidence must not be deployed, including when verification cannot complete.

Which solution best meets these requirements?

**Correct answer:** Use AWS Signer with Notation in the security-controlled pipeline to sign images after all required tests pass. Restrict use of the signing profile to that pipeline. Before deployment, verify the signature against a trust policy for the approved signing identity, reject missing or invalid signatures and verification errors, and deploy the verified image by digest.

**Explanation:** Signing after successful testing binds the approved signing identity to the image digest. Restricting signing permissions makes that identity evidence of the approved pipeline. Explicit signature verification with a trusted identity and fail-closed behavior rejects unapproved or unverifiable images. Deploying the verified digest ensures production uses the exact artifact that was checked.

### Question 4 (DVA-C02)

**Question:**

A company deploys a web application through a CI/CD pipeline to a load-balanced AWS Elastic Beanstalk environment. Application bundles include installation scripts for native dependencies. Previous deployments updated existing instances in batches, and failed installations left some instances with partially updated dependencies.

For future releases, the developer must configure application deployments so that dependency installation occurs only on newly provisioned instances. The current instances must continue serving traffic without modification until the replacement fleet passes health checks. If deployment fails, Elastic Beanstalk must discard the replacement instances and leave the current fleet running. The company has sufficient quota for temporary additional capacity and wants to retain a single Elastic Beanstalk environment.

Which deployment configuration meets these requirements?

**Correct answer:** Set DeploymentPolicy to Immutable.

**Explanation:** An immutable application deployment launches replacement instances in a temporary Auto Scaling group and deploys the new version to them without updating the original instances. After the replacement instances pass health checks, Elastic Beanstalk completes the transition and terminates the old instances. If deployment fails, it terminates the replacement instances and preserves the original fleet.

### Question 5 (DOP-C02)

**Question:**

A company runs document-processing workers on Amazon EC2 instances in an Auto Scaling group. Job inputs, results, and checkpoints are stored outside the instances. A version-controlled build specification defines the approved operating system, application packages, and security agents.

During an investigation, engineers discover unauthorized packages and scheduled tasks on several workers. The complete set of local changes is unknown. The security team requires the affected workers to be isolated and their EBS volumes preserved for forensic analysis before disposal. Operations must restore processing capacity to a verified software baseline without propagating potentially unauthorized changes. Healthy workers can continue processing jobs.

Which recovery approach best meets these requirements?

**Correct answer:** Isolate the affected workers and snapshot their EBS volumes for restricted forensic retention. Use EC2 Image Builder with a trusted source image and the approved build specification to produce and validate an AMI. Launch replacement workers from that AMI without reusing the affected volumes, and terminate the isolated workers after evidence preservation is verified.

**Explanation:** This restores capacity from a controlled, tested definition rather than attempting to repair an unknown software state. Separately preserving the affected volumes retains evidence without incorporating their contents into replacement workers. External job state allows replacements to resume processing without depending on the affected instances.

### Question 6 (SAA-C03)

**Question:**

A company runs document-conversion workers in an Amazon EC2 Auto Scaling group across two Availability Zones. Jobs and results are stored outside the instances. Each instance launches from a base operating system AMI and downloads the application and conversion libraries from a vendor repository during startup. A recent repository outage prevented Auto Scaling from replacing failed workers. The team also discovered that workers launched on different days had different library versions.

The company needs replacement workers to run the exact software versions approved during release testing, even when the vendor repository is unavailable. Access to AWS services and the company's runtime configuration store remains available during these outages.

Which change should a solutions architect recommend?

**Correct answer:** Build and test a versioned AMI containing the approved operating system, application, and libraries before each release. Configure the Auto Scaling group to use a specific launch template version that references this AMI, and retrieve only runtime configuration during startup.

**Explanation:** A tested, self-contained AMI makes replacement workers reproducible and removes the vendor repository from the recovery path. Pinning the launch template version and AMI ensures that replacements use the approved software stack rather than installing potentially different software at startup.

## Practice Immutable Infrastructure in a full exam

Questions on Immutable Infrastructure in each practice exam, with every answer option and an explanation for each:

- [SAA-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate): 9 questions
- [DOP-C02](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional): 8 questions
- [SOA-C03](https://blowstack.com/practice-exams/aws-certified-cloudops-engineer-associate): 6 questions
- [SCS-C03](https://blowstack.com/practice-exams/aws-certified-security-specialty): 6 questions
- [MLA-C02 (beta)](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate): 2 questions
- [SAP-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional): 1 question
- [DVA-C02](https://blowstack.com/practice-exams/aws-certified-developer-associate): 1 question

## What is Immutable Infrastructure

Immutable infrastructure treats deployed compute resources as replaceable instances of a controlled definition. Instead of logging into production servers to install patches or changing software inside running containers, engineers update the build definition, produce a new image, test it, and replace the affected resources. The objective is consistent, traceable deployments rather than a promise that running systems cannot change.

A typical cloud implementation combines version-controlled infrastructure definitions with automated image builds. A virtual machine image can include a patched operating system, approved packages, logging configuration, endpoint protection, and a management agent. A container image can include a minimal runtime, pinned dependencies, and an application configured to run without root privileges. Build pipelines should scan and test these artifacts, restrict who can publish them, and record their provenance. Secrets and long-lived credentials should not be embedded in either image type; workloads should obtain credentials and configuration through controlled runtime mechanisms.

For example, an EC2 fleet can use a launch template that references an approved AMI. To remediate a vulnerable library, build and validate a replacement AMI, create a new launch template version, and roll the fleet onto that version using an instance refresh. For containers, rebuild the image and update the deployment to a specific image digest. A mutable tag such as latest does not reliably identify the artifact that was tested. Health checks, capacity headroom, and connection draining help replacements occur without unnecessary service interruption.

Hardening belongs in the build process, but some controls must be applied at deployment or runtime. Installing the Systems Manager Agent in an AMI does not by itself make an instance manageable: the instance also needs suitable permissions, connectivity, and a supported agent configuration. Similarly, a hardened container image does not enforce the workload's network policy or runtime privileges. Least-privilege roles, restricted network access, monitoring, and runtime security controls remain necessary.

During a security incident, replacing a compromised resource is a recovery technique, not the entire response. First contain the affected workload using appropriate network controls and remove it from normal traffic. Coordinate with orchestration and automatic replacement processes so that evidence is not inadvertently destroyed. Preserve required disk snapshots, logs, and, where appropriate, volatile evidence before termination. Restrict access to forensic artifacts because they may contain sensitive information.

Recover by deploying a trusted image that addresses the entry point, rotating exposed credentials, and checking for persistence outside the replaced resource. Restore persistent data from a validated recovery point when necessary, and verify that the restored data does not reintroduce malicious content. An image captured from a compromised server is not a trustworthy recovery baseline. Replacing compute alone does not remove an attacker’s access through stolen credentials, altered identity policies, or infected shared storage.

The main trade-offs are build latency, image maintenance, temporary replacement capacity, and the need to separate application state from disposable compute. Emergency in-place patching may sometimes be justified, but it creates an exception that must be incorporated into the next approved image. Infrastructure as code alone does not make a system immutable if deployments still modify existing hosts. Immutable infrastructure also does not replace backups, and rolling back an image may be unsafe when database schemas have changed or the previous image contains a known vulnerability.

## Learn Immutable Infrastructure in lessons

10 short lessons on Immutable Infrastructure in 6 certification courses.

- MLA-C02 (beta): Immutable Infrastructure: replacing ML workloads with versioned container images (Premium), https://app.blowstack.com/lessons/immutable-infrastructure-replacing-ml-workloads-with-versioned-container-images-mla-c02
- SAP-C03: Immutable Infrastructure: recovery through replacement (Premium), https://app.blowstack.com/lessons/immutable-infrastructure-recovery-through-replacement-sap-c03
- SOA-C03: Immutable Infrastructure: image-based replacement (Premium), https://app.blowstack.com/lessons/immutable-infrastructure-image-based-replacement-soa-c03
- SCS-C03: Immutable Infrastructure: trusted image baselines (Premium), https://app.blowstack.com/lessons/immutable-infrastructure-trusted-image-baselines-scs-c03
- DOP-C02: Immutable Infrastructure: replacement-based deployments (Premium), https://app.blowstack.com/lessons/immutable-infrastructure-replacement-based-deployments-dop-c02
- SAA-C03: Blue-Green Deployment vs. Immutable Infrastructure (Premium), https://app.blowstack.com/lessons/blue-green-deployment-vs-immutable-infrastructure-saa-c03
