AWS › IaC (CloudFormation)

What is AWS CloudFormation and how does infrastructure as code improve the way teams manage their AWS resources?

Beginner

Answer

AWS CloudFormation lets you define your entire AWS infrastructure, including EC2 instances, VPCs, databases, and security groups, as declarative text based templates, and then automatically creates, updates, or deletes those resources consistently based on that template, providing significant advantages over manually clicking through the console, such as repeatability, version control history, and the ability to review infrastructure changes before they are applied, just like reviewing changes to application code.
aws cloudformation create-stack --stack-name my-stack --template-body file://template.yaml
Real-world example A development team defines their entire application's infrastructure, including a VPC, EC2 instances, and a database, in a single CloudFormation template stored in version control, allowing them to recreate an identical environment for a new project in minutes rather than manually configuring everything again.

Common follow-ups: What is the difference between CloudFormation and other infrastructure as code tools like Terraform?;Can CloudFormation manage resources that were originally created manually?