Skip to main content
Cloud / DevOpsDeployment StrategiesDiagramBeginner

Infrastructure as Code

KO: 코드형 인프라·EN: Infrastructure as Code·JA: コードとしてのインフラ·IaC

The practice of defining, versioning, and provisioning cloud infrastructure—networks, compute, databases, and IAM—through declarative code instead of manual console clicks

Table of Contents

Structure Diagram

IaC Declarative Provisioning Loop (Write → Plan → Apply)
IaC StateWrite CodePlan DiffApplyDrift Check
2/4Plan Diff
Preview add/change/destroy
Quick Answer

What is Infrastructure as Code?

The practice of defining, versioning, and provisioning cloud infrastructure—networks, compute, databases, and IAM—through declarative code instead of manual console clicks. It is a core concept in Deployment Strategies within Cloud / DevOps.

Core Principles

Infrastructure as Code (IaC) manages networks, compute clusters, databases, and IAM policies through version-controlled, declarative code rather than manual web console configuration. Its defining property is idempotency: running the same template repeatedly always converges to the exact same infrastructure state.

By treating infrastructure like application source code, teams gain peer-reviewed pull requests, repeatable staging/production parity, and rapid disaster recovery across regions.

Practical Takeaways

  • Use remote state with locking: Never store state files locally. Persist encrypted state in remote storage (e.g., S3 + locking) so team members and CI pipelines never corrupt shared infrastructure.
  • Isolate blast radius by layer and environment: Split monolithic state files into smaller stacks (networking, databases, application workloads) and separate dev from production to speed up plans and limit accidental deletions.
  • Add Policy as Code checks: Run static scanners (Checkov, tfsec, OPA) during plan in CI to block public buckets or overly permissive security groups before apply.

Notable Examples

  • Terraform & OpenTofu: Industry-standard multi-cloud IaC tools using declarative HCL across AWS, GCP, Azure, and SaaS providers.
  • Pulumi & AWS CDK: Let engineers author reusable cloud abstractions in TypeScript, Python, or Go with full IDE support and unit testing.
  • Crossplane: Extends Kubernetes CRDs to provision and continuously reconcile cloud resources via GitOps.