juniorDevOps

What is Infrastructure as Code (IaC)?

Updated Apr 28, 2026

Short answer

IaC is managing and provisioning computing infrastructure through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools.

Deep explanation

IaC allows infrastructure to be version-controlled, tested, and automated. Tools like Terraform, CloudFormation, or Ansible define the desired state. This guarantees repeatability, prevents configuration drift, and allows infrastructure to be spun up or destroyed quickly.

Real-world example

Provisioning 10 identical staging environments for testing by running a single Terraform script, instead of clicking through the AWS console.

Common mistakes

  • Modifying infrastructure manually in the cloud console after it was provisioned by IaC, creating 'configuration drift'.

Follow-up questions

  • What is declarative vs imperative IaC?

More DevOps interview questions

View all →