CloudFormation
AWS CloudFormation
A service that builds and manages AWS configurations as code.
In one sentence
A service that builds and manages AWS configurations as code.
Overview
An Infrastructure as Code service that defines AWS resources in templates and creates, updates, and deletes them as stacks.
Common use cases
- Configuration management for S3, Lambda, and other resources
- Recreating the same environment
- Reviewing change history
CLF-C02 exam points
- Implements Infrastructure as Code
- Creates stacks from templates
- Reduces configuration mistakes from manual work
SAA-C03 exam points
- Use Change Sets to verify changes
- Use StackSets to deploy across multiple accounts and regions
- Design data protection using deletion policies
Practical Use
AWS CloudFormation is an Infrastructure as Code (IaC) service that defines AWS resources declaratively as templates (YAML or JSON) and manages creation, updates, and deletion collectively in units called stacks. Templates can define virtually any AWS resource — VPCs, subnets, EC2 instances, IAM roles, RDS, S3 buckets, and more — and executing a stack provisions resources in a consistent order while resolving dependencies. In practice, standard patterns include provisioning stacks from the same template for each environment (dev / staging / prod), using change sets to verify changes before applying them to production, and using StackSets to deploy across multiple accounts and regions at once. The advantages of CloudFormation include the fact that the resource configuration is retained in a repository as code, making change history trackable in Git; that the drift detection feature can detect configuration drift caused by manual console operations; and that the rollback feature can automatically revert to the previous state on deployment failure. Instead of writing templates directly, higher-level abstractions such as AWS CDK (writing IaC in general-purpose programming languages) or AWS SAM (serverless-focused) are also synthesized internally into CloudFormation. There is no charge for CloudFormation itself, but the created resources incur normal charges. Forgetting to stop them or mistakenly defining expensive resources can lead to cost incidents. CLF-C02 asks questions such as "Which service defines and manages AWS resources as code?" and "Which service creates resources collectively from a template?". Terraform (HashiCorp's third-party IaC) is sometimes mentioned alongside it, but CloudFormation should be remembered as the official, AWS-managed IaC. Starting at SAA-C03, the focus shifts to cross-stack references (Export / ImportValue), nested stacks, organization-wide deployments via StackSets, and the details of rollback behavior on deployment failure.
Official Documentation
Cost notes
- There is no additional charge for CloudFormation itself
- The AWS resources it creates are billed
Security notes
- Do not write secrets in templates
- Review templates that have IAM creation permissions
Related services
Related comparison articles
Related comparison articles have not been added for this term yet.
Related architecture diagrams
Related architecture diagrams have not been added for this term yet.
Tags
Last updated: 2026-06-01
Previous term
AWS Cloud Development Kit
Next term
Amazon CloudFront