AWS CloudFormation
AWS native service for defining and provisioning infrastructure as code using YAML or JSON templates, with state management and automatic rollback.
What it is
AWS CloudFormation is AWS's native infrastructure as code service. It defines resources in YAML/JSON templates, and CloudFormation handles creating, updating, and deleting resources in the correct order, with automatic rollback if something fails.
Key concepts
- Template: YAML/JSON file describing resources
- Stack: deployed instance of a template
- Change set: preview of changes before applying
- Drift detection: detect manual changes outside CloudFormation
- StackSets: deploy stacks across multiple accounts/regions
CloudFormation as foundation
Both CDK and SAM generate CloudFormation templates. Understanding CloudFormation is fundamental for debugging issues in any of these frameworks.
Limitations
- Verbose compared to CDK or Terraform
- AWS only (not multi-cloud)
- 500 resource limit per stack
- Some resources not immediately supported
Why it matters
CloudFormation is the native IaC service in AWS and the foundation on which CDK and SAM are built. Understanding it is necessary even if you use higher-level abstractions, because deployment errors and drift issues are diagnosed at the CloudFormation level.
References
- CloudFormation Documentation — Official documentation.
- CloudFormation Best Practices — AWS, 2024. Official best practices.
- CloudFormation Resources — AWS, 2024. Template resources and examples.