Before explaining what it exactly is, let me quote a really nice definition, straight from Wikipedia:
Infrastructure as Code (IaC) is the process of managing and provisioning computing infrastructure (processes, bare-metal servers, virtual servers, etc.) and their configuration through machine-processable definition files, rather than physical hardware configuration or the use of interactive configuration tools.
Okay, now let's look at one such IaC tool, TerraformTerraform to understand the concept better: https://www.terraform.io/
Also, this is what Terraform say about itself:
Terraform enables you to safely and predictably create, change, and improve production infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
This means, one can code the entire infra. which includes creation of cloud(/infra) resources like the server instances, load balancers, etc, along with the complete configurations (which includes the basic settings tweaks, security settings, regions, etc) as code, which can be editable, versionable and of course, reviewable.
This is a sample example of Terraform code for provisioning AWS resources:
resource "aws_elb" "frontend" {
name = "frontend-load-balancer"
listener {
instance_port = 8000
instance_protocol = "http"
lb_port = 80
lb_protocol = "http"
}
instances = ["${aws_instance.app.*.id}"]
}
resource "aws_instance" "app" {
count = 5
ami = "ami-408c7f28"
instance_type = "t1.micro"
}
Bonus PS: Also, one needs to understand the differences between provisioning and orchestration tools. Devs confuse one for the other very often and tend to make the mistake of trying to tweak and use a tool for what it is not intended to be used for.