CloudFormation lets you define your entire AWS infrastructure as YAML or JSON code. Instead of clicking through the console, you write a template and CloudFormation builds everything automatically — the same way, every time.
| Concept | Description | Example |
|---|---|---|
| Template | YAML or JSON file defining resources | VPC, EC2, RDS, ALB in one file |
| Stack | A deployment of a template | my-webapp-production stack |
| StackSets | Deploy same stack across multiple accounts/regions | Security baseline for entire organization |
| Change Sets | Preview changes before applying | Show me what will change before I update production |
| Drift Detection | Find manually changed resources | Who modified the security group without using code? |
CDK (Cloud Development Kit) lets you write infrastructure in Python, TypeScript, or Java that compiles to CloudFormation. Much more powerful than raw YAML:
# CDK Python Example — Create an entire web tier
web_tier = ecs_patterns.ApplicationLoadBalancedFargateService(
self, "WebService",
cluster=cluster,
memory_limit_mib=512,
cpu=256,
task_image_options=ecs_patterns.ApplicationLoadBalancedTaskImageOptions(
image=ecs.ContainerImage.from_registry("nginx")
)
)
# This ONE construct creates: ECS Service + ALB + Target Group
# + Security Groups + IAM Roles + CloudWatch Logs
# That would be 200+ lines of CloudFormation YAML!