Skip to content
LatestPillow CVE-2026-112897 leaks heap memory via crafted TIFF images
Cloud Security

Immutable Infrastructure: Six Misreadings That Break Your Cloud Security

Treating infrastructure as disposable code prevents drift, but it fails if you persist state incorrectly or trust the build process blindly.

Illustration: A pristine stack of blank gray boxes rests on a clean white surface, completely untouched by fingerprints or dust.
AI-generated illustration: RedTeam Log
Quick answer

Immutable infrastructure means you never modify running servers. You replace them entirely when changes are needed. This stops configuration drift and simplifies patching, but it requires strict state management and secure build pipelines to avoid moving risks upstream.

Misreading: Immutable means unchangeable forever

Many teams believe that once an asset is deployed, it sits untouched until the end of its lifecycle. This view treats immutability as a form of preservation rather than a method of replacement. The reality is that immutable infrastructure is designed to be discarded. You do not patch a running server. You build a new image with the patch applied and swap the old instance for the new one.

This distinction matters because it changes your operational rhythm. You stop thinking about maintenance windows and start thinking about deployment speed. If your process relies on logging into a machine to fix a broken configuration, you have broken the model. The machine is no longer a known, tested state. It is a unique snowflake with unknown variables.

Correct reading: Immutability is a strategy for replacement, not preservation. Every change requires a new build and a new deployment. The old instance is terminated, not updated.

Infographic: Immutable Infrastructure: Six Misreadings That Break Your Cloud Security. Immutability protects against runtime changes, not flaws in the initial image. Stateful data must live outside the ephemeral compute layer. The build pipeline becomes the new security perimeter. Disk snapshots do
Infographic: Immutable Infrastructure: Six Misreadings That Break Your Cloud Security. Free to share with a link to RedTeam Log.

Misreading: It eliminates configuration drift

Configuration drift occurs when servers diverge from their intended state over time due to manual changes or automated updates. Immutable infrastructure prevents this by ensuring every instance starts from the same known base. However, it does not prevent drift in the definition of that base.

If your infrastructure-as-code templates contain errors, every new instance will inherit those errors. The drift moves from the runtime environment to the build definition. You may find that your "drift-free" servers are all drifting together toward a broken state. This is a silent failure mode that is harder to detect because the instances look identical.

You must validate the build output, not just the final runtime. This often involves integrating container image scanning into your pipeline to catch vulnerabilities before they become part of the immutable base.

Correct reading: Immutability prevents runtime drift, but it shifts the risk to the build definition. You must treat your build scripts and templates with the same scrutiny you once applied to running servers.

Misreading: It solves state management

Stateful applications store data that must persist across restarts and replacements. Databases, session stores, and user uploads are examples of state. Immutable infrastructure treats compute as ephemeral, meaning it can be destroyed at any moment. If you store state on the local disk of an ephemeral instance, you lose that data when the instance is replaced.

Many teams attempt to solve this by taking frequent snapshots of the instance disk. This is inefficient and risky. Snapshots are point-in-time copies that can become inconsistent if the application is writing data during the capture. They also create a false sense of security regarding cloud backup strategies.

The correct approach is to separate state from compute. Use external storage services that are designed for persistence. The immutable instance connects to this external store at startup. If the instance dies, a new one spins up and reconnects to the same external state.

Correct reading: Immutability applies to compute, not data. State must be externalised to persistent storage that survives the lifecycle of the ephemeral compute instance.

Misreading: It secures the supply chain

Building a new image for every change sounds secure, but it introduces a new attack surface: the build pipeline. If an attacker compromises your build server or your source code repository, they can inject malware into every new instance you deploy. This is known as a supply chain attack.

Because the resulting instances are immutable, you might assume they are trusted. You are trusting the build process implicitly. This trust is misplaced if the pipeline lacks strict integrity checks. You need to verify that the base images are signed and that the build steps have not been tampered with.

This is where workload identity becomes relevant. The build process should use short-lived credentials that are limited in scope. If the build server is compromised, the attacker should not have access to production secrets or the ability to push images to the wrong registry.

Correct reading: Immutability moves the security boundary from the running server to the build pipeline. You must secure the pipeline as rigorously as you once secured the runtime.

Misreading: It replaces the need for secrets management

Some teams embed API keys and certificates directly into the immutable image to simplify deployment. This seems logical because the image is fixed and known. However, it creates a severe risk. If a secret is exposed, you must rebuild and redeploy every instance to rotate it.

This process is slow and painful. It often leads to teams leaving compromised secrets in place for extended periods. It also increases the attack surface. If an attacker gains read access to your image registry, they can extract all embedded secrets.

Secrets should never be stored in the image. Use a dedicated secrets manager that the instance queries at runtime. The instance receives the secret in memory only when needed. This allows you to rotate secrets without touching the infrastructure. This practice aligns with guidance on avoiding secrets in source code and extends it to the build artefact.

Correct reading: Secrets are dynamic, not static. Embedding them in immutable images defeats the purpose of fast rotation and increases exposure risk.

See also: Confidential Computing: 6 Misconceptions That Compromise Security · Data Center Resilience Planning: Keep Services Running During Failures

Misreading: It simplifies compliance audits

Compliance frameworks often require evidence that systems are configured securely. With mutable infrastructure, auditors check the running configuration. With immutable infrastructure, the running configuration is irrelevant because it is derived from the build.

Auditors must now examine the build process and the deployment logs. This is a significant shift. You need to provide evidence that the image was built from a specific version of the code, that it passed security scans, and that it was deployed without modification.

This requires detailed logging and traceability. You must be able to link a running instance back to a specific commit in your repository. Without this traceability, you cannot prove that the instance is secure. This often involves using tools that map to the Cloud Controls Matrix to ensure your build and deploy processes meet regulatory requirements.

Correct reading: Compliance evidence shifts from runtime configuration to build and deployment logs. Traceability from instance to source code is mandatory.

Misreading: It handles all failure scenarios

Immutable infrastructure assumes that you can always build and deploy a new instance. This fails if your build process is broken or if your external dependencies are down. If your image registry is compromised or unavailable, you cannot replace failed instances.

This creates a single point of failure in your build infrastructure. You must ensure that your build pipeline is resilient and that you have a fallback mechanism. This might involve keeping a cache of recent, known-good images that can be deployed in an emergency.

However, this cache must be managed carefully. It should be small and rotated frequently. It is a bridge, not a long-term solution. The primary path must always be a fresh build from source.

Correct reading: Immutability relies on a healthy build pipeline. Ensure your build infrastructure is resilient and that you have a contingency plan for build failures.

Key takeaways

  • Immutability protects against runtime changes, not flaws in the initial image.
  • Stateful data must live outside the ephemeral compute layer.
  • The build pipeline becomes the new security perimeter.
  • Disk snapshots do not equal immutable backups.
Bottom line

Immutable infrastructure shifts risk from runtime management to build security and state externalisation. Audit your build pipeline and separate state from compute immediately.

Frequently asked questions

Does immutable infrastructure prevent ransomware?

It limits the spread because you cannot modify running files, but it does not prevent initial compromise. If the build process is infected, all new instances will be compromised.

Can I use immutable infrastructure for legacy applications?

Yes, but it requires significant refactoring. Legacy apps often rely on local state and manual configuration, which must be externalised and automated.

How do I debug an immutable instance?

You do not debug the running instance. You reproduce the issue in a test environment using the same image, or you analyse logs and metrics exported from the instance.

Is immutable infrastructure more expensive?

It can reduce operational costs by simplifying patching and reducing downtime. However, it may increase compute costs due to the overhead of spinning up new instances.

How this guide was produced: written by the RedTeam Log editorial team with AI assistance, checked against the public references listed below, and reviewed when the facts change. See our editorial policy or report an error.

Further reading

  1. Cloud Security Alliance
  2. CIS Benchmarks
  3. Kubernetes: Security Concepts
immutable infrastructurecloud securityinfrastructurebuild pipeline

Related stories

Microsegmentation for Small Teams: Contain Breaches Fast

Microsegmentation restricts lateral movement by enforcing strict rules between workloads, limiting damage even when perimeter defences fail.