The practice of managing and provisioning infrastructure through code files rather than manually clicking buttons in a web console.
Configuring servers manually (ClickOps) is slow, error-prone, and impossible to replicate perfectly. If you lose the server, you have to remember every single button you clicked to rebuild it.
You write a "Blueprint" (Code). You run a tool (Terraform/CloudFormation). The tool builds the servers. If disaster strikes, you just run the code again.
IaC tools ensure your live infrastructure matches your code. If someone manually changes a firewall rule, the IaC tool detects the "Drift" and fixes it automatically.
Mission: Deploy 10 Servers. See which method scales better.
Task: Click the button 10 times. Wait for each to finish.
Task: Write code once. Apply.
You tell the computer HOW to do it.
If you run this twice, you might get 2 servers or an error.
You tell the computer WHAT you want.
If you run this twice, nothing happens (because you already have 1 server). This is called Idempotency.
| Tool | Type | Best For | Description |
|---|---|---|---|
| Terraform | Declarative | Multi-Cloud | The industry standard. Uses HCL language. Works with AWS, Azure, Google, etc. |
| CloudFormation | Declarative | AWS Only | Native to AWS. Deep integration but verbose (YAML/JSON). |
| Ansible | Imperative* | Config Management | Best for configuring software inside servers (installing packages, patching). |
| Pulumi / CDK | Code | Developers | Use real programming languages (Python, TypeScript) to define infrastructure. |