What is Infrastructure as code (IaC)?
A method of describing the configuration of infrastructure such as servers, networks and storage in code (definition files) rather than by hand, and creating and changing it automatically with tools. With declarative tools you write the desired configuration, and the tool applies only the difference from the actual state, so applying the same definition any number of times gives the same result (idempotence). Managing the definitions in Git or similar makes change history, review and reproducing identical environments easy.
Japanese name: IaC(Infrastructure as Code)
Infrastructure as code (IaC) appears in 1 practice question across 1 topic, including Cloud and Container Basics.
Field: Cloud and Container Basics
Declarative versus procedural
In a declarative style you write the result, such as "two virtual machines", and the tool compares it with the current state to decide what to do. In a procedural style you write operations in order, such as "create one virtual machine", so you must take the current state into account; running it twice could create four machines. Declarative methods, which make idempotence easy, are widely used for infrastructure configuration.
FAQ
Does IaC eliminate manual configuration?
Much of the work can be turned into code, but some manual steps, such as the initial authentication setup, remain. What matters is not to leave manual changes as they are but to bring them into the code, keeping the code and the actual state consistent.
How is IaC related to containers?
IaC is used to build foundations such as networks, virtual machines and clusters, and the applications running on them are often delivered as container images. Kubernetes manifests follow the same idea as IaC in that they declare a desired state.