DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk4 min

Definition of Infrastructure as Code (IaC): What It Means and How It Works

Infrastructure as code defines and manages infrastructure through versioned files rather than manual configuration. Here is what it covers, how it works, and how to choose a tool.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Infrastructure as code (IaC) is the practice of defining and managing computing infrastructure in code or configuration files, instead of configuring it by hand through a console or user interface. Tools read those files and provision or update the resources they describe, so the setup becomes repeatable, reviewable and versioned like application code.

The definition, in the vendors’ own words

The major platform vendors phrase it slightly differently, but they agree on the core idea.

As an Amazon Associate I earn from qualifying purchases.

  • HashiCorp’s Terraform glossary: “Infrastructure-as-Code (IaC) is the practice of managing infrastructure in a file or files rather than manually configuring it via a user interface.”
  • HashiCorp’s IaC guidance describes version-controlled specifications that people can review, test and automate. The configuration describes the desired infrastructure state, and tools create, modify or manage resources to match it.
  • AWS defines it as provisioning and managing application infrastructure through configuration files.
  • Microsoft Learn describes a versioned, descriptive model used to define and deploy things such as networks, virtual machines, load balancers and connection topologies.

Taken together, the definition is not tied to one tool, one language, or the public cloud. Terraform, CloudFormation and Bicep are implementations of the practice, not the practice itself.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What counts as “infrastructure”

Infrastructure here means the resources an application runs on: compute (such as virtual machines), networks and subnets, load balancers, storage, operating-system configuration, and supporting services. The boundary depends on the system. AWS’s guidance treats serverless services, queues and workflow components as infrastructure too, since they are provisioned and configured as resources.

How infrastructure as code works

  1. Describe. Write a definition of the resources and their settings: for example a network, a subnet, a compute instance and a storage bucket. HashiCorp’s own example expresses exactly this in its HCL language.
  2. Version. Store the files in version control, so every change has history, an author and a review trail.
  3. Review and validate. Teammates review changes as they would application code. AWS notes that code can be scanned before deployment, and testing can happen before anything is created.
  4. Apply. An IaC tool, often run from a CI/CD pipeline, compares the definition with the target environment and creates or changes resources to match. In Terraform, providers talk to platform APIs, and state tracks what has been created so the tool can work out dependency order.
  5. Change by editing the source. To alter an environment, you edit the definition and deploy again, rather than modifying each server or setting individually.

Declarative versus imperative IaC

Approach You write Strength Cost
Declarative The components and configuration you want; the tool works out how to reach that state Abstracts away execution details; often preferred where the tool supports it Less direct control over the order of operations
Imperative The ordered steps for creating or configuring resources Useful when sequencing or complex procedural logic matters More procedural detail to write and maintain

The two are not mutually exclusive. AWS CDK, for instance, lets you write in a general-purpose programming language (code-first) and synthesizes CloudFormation templates, which are declarative. There is also no standard declarative syntax: Microsoft lists YAML, JSON and XML as platform-dependent formats, and names Azure Resource Manager templates and Bicep as Azure options.

Idempotence and drift

Two concepts come up constantly. Idempotence, as Microsoft describes it, means a deployment operation should converge on the same configuration regardless of the target’s starting state: run it on an empty environment or a half-configured one and you end up with the same result. Configuration drift is when environments diverge because of manual, ad hoc changes. IaC addresses drift by making the source definition the place where changes are made and redeployed.

Both are goals that depend on well-written definitions and a disciplined workflow. They are not automatic properties of every command in every tool.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Benefits and limits

  • History and review: version control and code review apply to infrastructure changes.
  • Repeatable environments: the same definition can create development, test and production setups.
  • Automation: deployments can run through CI/CD pipelines, with testing before deployment.
  • Living documentation: the definitions record what is supposed to exist.
  • Limits: IaC does not by itself guarantee security, compliance, consistency or error-free changes. A bad definition is applied just as faithfully as a good one, and drift can still occur if people keep changing resources outside the code.

Common tools

These are examples of the category, not a ranking.

Tool What it is
Terraform Provider-based tool using HCL and state; works with cloud providers and services in its provider ecosystem, and with systems that expose an API (per HashiCorp)
AWS CloudFormation AWS service for modeling and provisioning infrastructure from templates
AWS CDK Code-first toolkit using programming languages; synthesizes CloudFormation templates
AWS SAM AWS option oriented to serverless application resources
Pulumi One of the options AWS compares for provisioning on AWS
Azure Resource Manager templates and Bicep Azure-native options named by Microsoft
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choosing a tool

AWS’s guidance is explicit that there is no one-size-fits-all tool. Useful questions to ask:

  • Which platforms and providers must it support, and how complete is its resource coverage?
  • Do you prefer declarative templates or a code-first approach, and what languages does the team already know?
  • How does it handle planning, review and testing before changes are applied?
  • How is state stored and shared between collaborators?
  • Does it fit your existing CI/CD and policy processes, and how much control over resources do you need?

Tool features change, so check current documentation before committing to one.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.