100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Cloud

AWS CloudFormation

By Amazon Web Services

IntermediateTool12.2K learners

AWS CloudFormation is an infrastructure-as-code service that lets you define and provision AWS resources using declarative JSON or YAML templates, so entire environments can be created, updated, and deleted as a single managed unit called…

Definition

AWS CloudFormation is an infrastructure-as-code service that lets you define and provision AWS resources using declarative JSON or YAML templates, so entire environments can be created, updated, and deleted as a single managed unit called a stack.

Overview

AWS CloudFormation is the native Infrastructure as Code (IaC) service for AWS. Instead of clicking through the console to create resources like EC2 instances, VPCs, IAM roles, or Lambda functions one at a time, engineers write a template describing the desired end state, and CloudFormation figures out the order of operations needed to create, update, or delete each resource safely. Resources are grouped into stacks. When a template changes, CloudFormation computes a change set showing exactly what will be added, modified, or destroyed before anything is applied, which makes it possible to review risky changes ahead of time. If a deployment fails partway through, CloudFormation automatically rolls the stack back to its last known-good state, which is a key reliability advantage over manually scripted deployments. CloudFormation underpins many higher-level AWS tools: the AWS Cloud Development Kit (CDK) compiles typed application code down to CloudFormation templates, and AWS Elastic Beanstalk and AWS SAM use it behind the scenes to deploy application stacks. It competes most directly with Terraform, which is cloud-agnostic and has become the more popular choice for teams managing multi-cloud environments, while CloudFormation remains a strong default for AWS-only shops that want first-party support and no external state file to manage. Learners building AWS skills can go deeper in the AWS Core Services course.

Key Features

  • Declarative JSON or YAML templates describing the desired infrastructure state
  • Stacks group related resources so they can be created, updated, or deleted as one unit
  • Change sets preview exactly what will change before a deployment is applied
  • Automatic rollback restores the last known-good state if a deployment fails
  • Nested stacks and modules support reusable, composable infrastructure patterns
  • Drift detection identifies when live resources have diverged from the template
  • StackSets deploy the same template across multiple AWS accounts and regions
  • Deep integration with IAM for fine-grained control over who can provision what

Use Cases

Standing up repeatable multi-tier application environments (VPC, compute, database, load balancer)
Enforcing consistent, auditable infrastructure across dev, staging, and production accounts
Provisioning resources as part of a CI/CD pipeline alongside application code
Rolling out the same account baseline (IAM roles, logging, guardrails) across an organization with StackSets
Packaging and distributing serverless applications via nested stacks and SAM
Codifying disaster-recovery environments that can be re-created quickly in another region

Frequently Asked Questions