CloudFormation and the CDK

Lesson 1 of 4 in Provisioning ML Infrastructure as Code.

The blueprint asks you to provision and configure deployment resources; this module is about doing it as code, not by clicking. AWS CloudFormation is the engine — a declarative JSON/YAML template describing desired state, deployed as a stack that creates, updates, and deletes resources as a unit. The AWS CDK is a front end to that engine: you write constructs in TypeScript or Python, cdk synth compiles them into a CloudFormation template, and cdk deploy hands it to the same engine. One mental model, exam-ready: CDK writes templates; CloudFormation executes them.

Same engine, two authoring experiences
CloudFormationCDK

You write

Declarative JSON/YAML templates

TypeScript/Python (also Java, C#, Go) constructs

Abstraction

Raw resources, every property explicit

L2/L3 constructs bake in defaults; loops, conditionals, reuse

Preview

Change sets

cdk diff (change sets under the hood)

Runtime

Stacks, rollback, drift detection

Identical — it is CloudFormation after synth

The tell

"Declarative template", org-standard YAML

"Define infrastructure in Python/TypeScript"

Interactive checkpoint quiz (2 questions) — open this page in a browser to take it.