Cloud & DevOps

What is Infrastructure as Code?

Quick answer

Managing and provisioning servers, networks, and cloud resources through machine-readable configuration files instead of manual setup.

Infrastructure as Code, explained

Infrastructure as code (IaC) treats infrastructure the same way developers treat application code. Instead of clicking through a cloud console to create servers, databases, and firewalls, engineers describe the desired setup in files that can be versioned in Git, reviewed, tested, and applied automatically.

For example, a Terraform file might declare a virtual network, two virtual machines, and a load balancer. Running the tool creates exactly that, and running it again in another region produces an identical copy. Popular tools include Terraform, OpenTofu, AWS CloudFormation, Pulumi, and Ansible. IaC reduces human error, makes environments reproducible, and supports disaster recovery. It does require discipline, since manual changes made outside the code can cause configuration drift.

Related terms

Guides that mention Infrastructure as Code