Glossary termPractice

Immutable Infrastructure

Approach in which servers and other components are never modified after deployment; changes are made by replacing them with freshly built versions.

Immutable infrastructure is an operating model in which deployed components are treated as unchangeable. Instead of logging into a running server to apply patches, edit configuration or upgrade software, engineers build a complete fresh image containing the change, deploy instances from it and destroy the old ones. The image, whether a virtual machine template or a container image, is built by an automated process from versioned definitions, so every running instance can be traced back to a known, reproducible build.

The approach is a reaction to configuration drift, the gradual divergence of servers that are modified by hand or by scripts over months and years until no two are quite alike and none can be recreated with confidence. It is often summarized with the pets versus cattle analogy: pets are unique servers nursed back to health when ill, while cattle are interchangeable and simply replaced. The idea gained wide currency around 2013, helped by cloud computing, where machines can be created and discarded cheaply, and by containers, whose images are immutable by design.

Immutable infrastructure simplifies rollback, since the previous image still exists, and it supports Blue-Green deployment and consistent testing, because the artifact tested is the artifact deployed. It can also improve security: if servers never need interactive changes, remote shell access can be restricted or removed, and any unexpected modification is itself a warning sign. The model requires that persistent data live outside the replaceable components, in databases or storage services, and it shifts effort into fast, reliable image builds. It builds directly on infrastructure as code.

Key points

  • Changes are made by building and deploying a fresh image, never by modifying running servers.
  • The practice eliminates configuration drift between supposedly identical machines.
  • Persistent data must live outside replaceable components, in databases or storage services.
  • Rollback becomes simple because previous images remain available for redeployment.

Related entries

Glossary term

Practice of defining and provisioning servers, networks and other infrastructure through machine-readable files rather than manual configuration.

Glossary term

Immutable, layered package of an application's files, dependencies and metadata that serves as the template from which containers are started.

Glossary term

Discipline and tooling for establishing and maintaining a known, consistent state for systems, software and their settings over time.

Glossary term

Release technique that runs two identical production environments and switches user traffic from the old version to the new one in a single step.

Glossary term

GitOps

DevOps

Operational model in which a Git repository holds the declared state of infrastructure and applications, and automated agents keep systems in sync with it.

Glossary term

Delivery of computing resources such as servers, storage, databases and software over a network on demand, with users paying for what they use.

Technology

NixOS

FOSSDevOps

Linux distribution built on the Nix package manager that describes the whole system in declarative configuration and supports atomic upgrades and rollbacks.

Featured in guides

Referenced by

Other entries that discuss or point to Immutable Infrastructure.