Skip to content

CloudFormation

What It Is

AWS CloudFormation manages AWS resources declaratively through stacks and templates.

Core Ideas

  • template in YAML or JSON
  • stack as a deployment unit
  • change sets for previewing changes
  • tight integration with the AWS ecosystem

Common Commands

aws cloudformation validate-template --template-body file://template.yaml
aws cloudformation create-stack --stack-name app --template-body file://template.yaml
aws cloudformation deploy --template-file template.yaml --stack-name app
aws cloudformation describe-stacks --stack-name app
aws cloudformation delete-stack --stack-name app

When to Choose It

  • when the infrastructure is mainly AWS
  • when a native AWS model is preferred
  • when the team already lives in the CloudFormation or CDK ecosystem

Practice

  • Use change sets before production changes.
  • Keep templates in Git like any other IaC code.