Beginner

CloudFormation Stacks

Write a CloudFormation template in YAML that creates a VPC and EC2 instance, deploy it as a stack with the CLI, update it through a change set, detect drift, and practice the full stack lifecycle including rollback.

~2.5h
0 / 7 steps
🚀
Intro

What you're building

Prerequisites: An AWS account, AWS CLI v2 configured, basic YAML familiarity.

AWS CloudFormation is AWS's native infrastructure-as-code service. Like Terraform, it deploys and manages infrastructure from a declarative template — but CloudFormation is fully native to AWS (no provider to install, no state file to manage), integrated with IAM, and supports over 1,000 AWS resource types directly. The state is managed by CloudFormation on your behalf.

The key CloudFormation mental model: a stack is a running deployment of a template. You manage the template, CloudFormation manages the stack. Templates can be YAML or JSON; YAML is more readable and supports comments. The only required section of a template is Resources.

🔨

Write the CloudFormation template

🔨

Validate and deploy the stack

🔨

Update via change set

🔨

Detect drift

🎯
Secret Mission

Secret Mission: Stack policy to protect critical resources

🧹
Wrap Up

Before You Go

Pro

Test what you just learned

Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.

Log in to unlock