1. CloudFormation
Infrastructure as Code (IaC) service — like Ansible or Terraform but native to AWS.
Purpose
Automates creation, configuration, and management of AWS infrastructure using code (YAML/JSON templates).
Key Concepts
Template
→ Declarative file describing resources (EC2, S3, RDS, etc.)
Stack
→ A deployed instance of a CloudFormation template.
Change Set
→ Preview of what changes will happen before applying.
Nested Stacks
→ Reusable modular stacks (for large infra).
Parameters/Outputs
→ Variables in templates to make them reusable.
Nuances
AWS-native, integrates seamlessly with IAM, EC2, ECS, etc.
State is managed automatically (unlike Terraform which uses a local or remote state file).
Slow to deploy large infra compared to Terraform but
best for AWS-only environments
.
You can use
CloudFormation + CDK (Cloud Development Kit)
for more readable, code-based definitions (TypeScript/Python).
Best Practices
Store templates in Git + automate via CI/CD.
Use
Change Sets
before updating stacks.
Split large stacks into
nested stacks
.