ENES

Infrastructure as code

Describing servers, networks and databases in files instead of clicking.

A text file describing a server, a bucket and a database, applied to create those resources in the cloud

Infrastructure as code (IaC) means writing down the cloud resources you need in a text file and letting a tool create them. Instead of clicking through the AWS console to make a virtual machine, a bucket and a database, you write "one Amazon EC2 instance of this size, one Amazon S3 bucket with this name, one Amazon RDS database", run a command, and the tool makes the cloud match the file.

The big win is repeatability. The file lives in Git next to the application code, so every change is reviewed, has an author and can be undone. Need an identical staging environment? Run the same file again. Someone deleted a server by accident? Re-apply and it comes back. Clicking gives you none of that, and nobody remembers what was clicked six months ago.

The common tools are Terraform (works with every cloud, with its own language called HCL), AWS CloudFormation (AWS only, in YAML or JSON), Pulumi and the AWS CDK (both use regular programming languages). All of them compare what the file says with what exists and show a plan ("will create 2, change 1, destroy 0") before touching anything.

Keep in mind

Go deeper

Related terms

More in Cloud