CloudFormation, CDK and Bicep

The cloud providers' own IaC tools: AWS CloudFormation and CDK, and Azure Bicep, deeply integrated with a single cloud.

Intermediate · about 8 hours · difficulty 3/5

Learn first: Infrastructure as Code Principles

Each large cloud offers a native IaC service. They cover one provider only, but they are supported from day one for new features and need no separate state to manage.

AWS CloudFormation

  • Templates in YAML or JSON declare resources, parameters and outputs.
  • A stack is a deployed template; AWS stores its state for you.
  • Change sets preview what an update will do, like a Terraform plan.
  • Failed updates roll back automatically.
  • StackSets deploy the same template across many accounts and regions.
  • Drift detection compares stacks with reality.

AWS CDK

The Cloud Development Kit lets you write TypeScript, Python, Java or Go that synthesises CloudFormation. Higher-level constructs create sensible defaults (a load-balanced Fargate service in a few lines). cdk diff and cdk deploy wrap the change-set workflow.

Azure Bicep

A concise language that compiles to ARM templates. Deploy with az deployment group create, preview with what-if, and share modules through registries.

When to choose native tools

Pick them when you are all-in on one cloud and want zero extra infrastructure, or when an organisation standard requires it. Choose Terraform or Pulumi when you manage several providers (cloud plus DNS plus GitHub plus monitoring) from one codebase.

Good enough to move on: you can deploy and update a stack with a change set or what-if preview, explain automatic rollback, and argue native vs multi-cloud IaC for a given company.

Key concepts

  • CloudFormation templates and stacks
  • Change sets and rollback
  • StackSets
  • AWS CDK constructs
  • Azure Bicep and what-if
  • Native vs multi-cloud IaC

Other options for this step

  • Terraform and OpenTofu: Provision cloud resources declaratively with HCL, providers, state and modules, using the most widely adopted IaC tool.
  • Pulumi: Infrastructure as code written in general-purpose languages like TypeScript, Python or Go, with real loops, functions and tests.

Mini project

Build the same S3 bucket plus Lambda function twice, once as a raw CloudFormation template and once with CDK, and compare template size, readability and the change-set output for a small edit.

Check yourself

A CloudFormation update fails halfway through. What happens to the resources it already changed?

Free resources