AWS CloudFormation
AWS CloudFormation is the infrastructure-as-code service from AWS. You describe your entire infrastructure in templates and CloudFormation generates them automatically, reproducibly and traceably.
What is AWS CloudFormation?
AWS CloudFormation is AWS’s in-house service for Infrastructure as Code (IaC). Instead of manually creating servers, networks and databases via the AWS web interface, you describe the entire infrastructure in a template – a text file in YAML or JSON format. CloudFormation reads this template and automatically creates all the resources described within it.
This turns infrastructure into code: it can be versioned, checked during a code review and recreated identically as often as required. Manual clicking – the most common cause of hard-to-find configuration differences between environments – is eliminated.
How CloudFormation works
- Template: The template declaratively describes the desired target state of the infrastructure.
- Stack: A specific instance of a template – all resources created from it are managed as a single unit.
- Change Set: A preview that shows, before any change is made, exactly what would be created, modified or deleted.
- Drift Detection: Detects when resources have been subsequently modified manually and deviate from the described state.
Advantages of Infrastructure as Code
The declarative approach of CloudFormation offers several tangible benefits. Environments such as staging and production can be created from the same template and are therefore guaranteed to have an identical structure. Every change to the infrastructure is traceable in the version history. And should an entire environment be lost, it can be fully restored from the template in a short time. If a change fails, CloudFormation can automatically reset the stack to its previous state.
CloudFormation and Terraform
CloudFormation specialises in AWS and is deeply integrated with it. The equally widespread Terraform follows the same Infrastructure-as-Code approach, but works across providers. For pure AWS environments, CloudFormation is the obvious choice; in multi-cloud scenarios, Terraform comes into its own. Both tools solve the same fundamental problem.
CloudFormation in SMEs
As soon as an infrastructure outgrows a few resources, Infrastructure as Code is the right foundation. CloudFormation ensures that knowledge of the environment does not exist solely in the minds of individuals, and makes every change verifiable. It is therefore also a key component of automated CI/CD pipelines, in which infrastructure changes are rolled out in a controlled manner.
Frequently asked questions about AWS CloudFormation
CloudFormation itself is free of charge for AWS-owned resources. You only pay for the infrastructure that is created with it - i.e. for EC2 instances, databases or network components. There are no additional fees for using the service itself.
Both implement infrastructure as code. CloudFormation specialises in AWS and is deeply integrated there. Terraform works across all providers and is suitable for multi-cloud environments. CloudFormation is the obvious choice for pure AWS setups, Terraform for multiple providers.
A change set is a preview of a planned infrastructure change. It shows exactly which resources would be created, changed or deleted before execution. This allows unintended effects to be recognised before the change actually takes effect.
CloudFormation can automatically reset a stack to its previous, functioning state in the event of an error (rollback). This keeps the infrastructure consistent instead of remaining in a half-changed intermediate state.
Related terms
Related services
Last updated: May 2026