What is Infrastructure as Code?

Learn the basics of IaC and the format of provisioning the IaC solution.

Introduction

Infrastructure is the collection of resources an application runs on. Traditionally, this was composed of servers, storage, and networking. With the advent of virtualization, servers are now split into both physical resources and virtual machines. Cloud providers create additional abstractions, starting with Infrastructure as a Service (IaaS) and moving up to Platform as a Service (PaaS) and Software as a Service (SaaS). Traditional infrastructure was deployed using manual and cumbersome processes that made mistakes and inconsistencies rather common. The various services offered by cloud providers and other vendors now introduce a software-driven model of creation and configuration.

IaC is the practice of defining and provisioning infrastructure resources through a machine-readable format. The infrastructure provisioned and managed using IaC can include bare-metal servers, virtual machines, networking resources, storage volumes, or even databases provided as a service. IaC is often used in a cloud environment, though this is technically unnecessary. As long as the infrastructure management system has a programmatic interface, it can participate in IaC.

Format of provisioning solution

The format can be declarative (defining the desired outcome) or imperative (defining the process of provisioning). Declarative provisioning solutions like Terraform are focused on the desired end state of deployment. They rely on an interpretation engine to create and configure the actual resources. Imperative provisioning solutions like batch script focus on the provisioning process and may reference a file containing a list of settings and configuration values.

The code created for IaC may be stored in a version control system (VCS) to enable change-tracking and team collaboration. IaC can also be combined with other common software development practices like automated testing, deployment pipelines, and reusable components. With IaC, infrastructure is defined and provisioned through machine-readable code and isn’t provisioned by hand using a portal, command line, or API. If a person performs the commands or processes manually, it’s not IaC.

Key takeaways

Infrastructure as Code is the practice of defining infrastructure deployments using machine-readable files that can be used to provision infrastructure in an automated fashion.