What it does
AWS CloudFormation is an infrastructure-as-code service for defining and managing AWS resources from YAML or JSON templates. Creating a stack provisions the template's resources as a managed unit; later updates can be previewed with a change set, and the stack can be updated or deleted as a unit. CloudFormation makes the underlying AWS service calls, so the caller needs permissions for the resources being created. The CloudFormation service itself is free, but resources in a stack are billed at their normal AWS rates.
Start with a small template and inspect the stack
CloudFormation's starting objects are a template and a stack. A template describes resource types and properties; creating a stack provisions them, and a single template can be used for multiple stacks. The AWS guide describes beginning in the Management Console with an example template. A minimal illustrative YAML template for an S3 bucket is:
AWSTemplateFormatVersion: '2010-09-09'
Description: A small example stack
Resources:
NotesBucket:
Type: AWS::S3::Bucket
Before creating a real stack, check the resource types, IAM permissions, account, and region. AWS charges for resources created by the template even though CloudFormation is a free service.
Review updates before applying them
For ongoing infrastructure, keep templates with application code and treat each stack as a lifecycle unit. Before changing a running stack, generate a change set to see proposed effects. This matters for stateful resources: AWS documentation gives the example that changing an RDS instance name can replace the database, so the old data can be lost unless it has already been backed up. Use change sets and resource-specific backup plans rather than assuming every update is in-place.
CloudFormation provisions resources by calling their AWS services, so an operator needs IAM permissions for each resource type. Its job is declarative provisioning and stack lifecycle, not source compilation or test execution; AWS CodeBuild is a separate service for build jobs. The price of a stack depends on the resources, their settings, and the region, so estimate those costs separately.
Strengths
- YAML or JSON templates let teams describe multiple AWS resources and reuse the same design for separate stacks.
- Stacks manage related resources as one unit, with create, update, and delete operations.
- Change sets preview proposed updates before applying them to running resources.
Watch out for
- The CloudFormation service is free, but resources created by a stack incur their own AWS charges.
- The caller needs AWS account access and IAM permissions for the resource types described in the template.
- A stack update can replace resources and risk data loss, so stateful changes require review and backups.
Best for
- Teams versioning repeatable AWS infrastructure alongside application code.
- Operators who want to create, update, or delete related AWS resources as a stack.
- Reviewing infrastructure changes before applying them to an existing environment.
Sources
- How CloudFormation works - AWS CloudFormation (Oct 25, 2026)
- Getting started with CloudFormation - AWS CloudFormation (Oct 25, 2026)
- Provision Infrastructure as Code - AWS CloudFormation - AWS (Oct 25, 2026)
