Asset 20 8 2
Does AI recommend your business? Run the free check →

Join 15,000 business owners, marketers and entrepreneurs. The Sunday newsletter you'll be annoyed only arrives once a week.

Article

Terraform vs CloudFormation: Infrastructure as Code Compared

Use AWS CloudFormation if everything you run lives on AWS and you want infrastructure as code built into the platform, with no additional charge for native AWS resources. Use Terraform if you work across several clouds or services, because its providers manage almost anything with an API, from AWS, Azure and Google Cloud to GitHub and Datadog. Both describe infrastructure in text files you can version; CloudFormation groups resources into stacks, while Terraform follows a Write, Plan and Apply workflow.

Both tools turn infrastructure into code, so the choice comes down to scope. I read HashiCorp's Terraform introduction and plans page and AWS's CloudFormation user guide, product page and charges page.

Terraform and CloudFormation at a glance

TerraformAWS CloudFormation
Made byHashiCorp, sold as part of IBM's HashiCorp Cloud PlatformAmazon Web Services
ScopeThousands of providers across clouds and servicesAWS resources, plus registry extensions
How you describe resourcesHuman-readable configuration filesTemplates describing AWS resources
Unit of deploymentConfiguration applied through Write, Plan, ApplyStacks you create and delete as one
Preview before changingPlan shows what it will create, update or destroyNot detailed on the pages I read
ChargesManaged IBM HCP Terraform plans charge per managed resourceNo additional charge for AWS::* resources

How each one charges you

This is where the two differ most for a small team. AWS's CloudFormation plans page says there's no additional charge for using CloudFormation with resource providers in the AWS::* and Alexa::* namespaces; you pay for the AWS resources you create, the same as if you'd made them by hand. Charges only apply per handler operation when you use registry extensions, such as third-party resource providers and hooks.

HashiCorp's plans page now sells Terraform as part of the IBM HashiCorp Cloud Platform. The managed IBM HCP Terraform tiers, Essentials, Standard and Premium, charge per managed resource each month, with a trial credit to get started, while IBM Terraform Enterprise is the self-managed option for companies with strict compliance needs.

Why teams choose Terraform

The Terraform docs describe it as a tool for defining cloud and on-premises resources in human-readable configuration files you can version, reuse and share. Providers let it work with virtually any platform or service with an accessible API, and HashiCorp and the community have written thousands of them, published on the Terraform Registry, covering AWS, Azure, Google Cloud, Kubernetes, Helm, GitHub, Splunk and Datadog. Its core workflow is Write, Plan and Apply, so you see the planned changes before anything happens.

Why teams choose CloudFormation

The CloudFormation user guide puts it simply: you create a template that describes the AWS resources you want, such as EC2 instances or RDS databases, and CloudFormation provisions them as a stack. Delete the stack and every resource in it goes too. Because templates are text files, you can keep them in version control and reuse them to build the same setup in another region, which makes environments consistent and repeatable.

A quick way to decide

  1. All your infrastructure is on AWS and likely to stay there: CloudFormation.
  2. You use two or more clouds, or manage SaaS tools like GitHub as code: Terraform.
  3. You want to see a plan of changes before applying them: Terraform's Plan step shows it.
  4. You want to tear down a whole environment in one go: CloudFormation stacks make that easy.
  5. You'd like no extra tool to pay for on top of AWS: CloudFormation has no additional charge for native resources.

For the wider context, read my take on why AWS stands out as a cloud provider, and this look at a cloud management suite shows how teams keep several clouds in order.

My advice on Terraform or CloudFormation

If you're an AWS-only business, start with CloudFormation; it's built in, has no extra charge for native resources and keeps your stack in one place. If you already use more than one cloud, or want GitHub, Datadog and DNS managed alongside your servers, learn Terraform instead, because one workflow covers them all. Whichever you pick, keep your templates or configuration files in version control from day one.

Work with me

Want AI doing the heavy lifting in your marketing?

I build the systems that handle the boring 80 percent, so you get your week back. Done properly, with the human kept in.

Do you make infrastructure as code or cloud tools? Tool makers can ask to be considered for a featured place in comparisons like this one.

Frequently asked questions

Is CloudFormation free?

AWS says there's no additional charge for CloudFormation with AWS::* and Alexa::* resource providers. You pay for the AWS resources it creates, and registry extensions are charged per handler operation.

Does Terraform work with AWS?

Yes. AWS is one of thousands of providers on the Terraform Registry, alongside Azure, Google Cloud, Kubernetes and GitHub.

Who owns Terraform now?

HashiCorp's plans page sells Terraform as part of the IBM HashiCorp Cloud Platform, with IBM HCP Terraform and IBM Terraform Enterprise.

What is a CloudFormation stack?

A stack is the set of AWS resources CloudFormation creates from a template. You can delete the stack to remove all of its resources at once.

Can Terraform manage more than one cloud?

Yes. Terraform's docs say its providers work with virtually any platform or service that has an accessible API.

Published and maintained by the Lilach Bullock team, covering marketing, AI and business growth.
Your buyers are asking AI who to use. Does it say you?

See for free whether ChatGPT, Claude, Perplexity, Gemini and Google name you, and get the plan to become the answer.

Check my AI visibility →
Sundays only

Get the Sunday newsletter.

One email a week. AI experiments, marketing tactics, and the workflows Lilach is building right now in her own business.

Subscribe free

Let’s get your marketing running on AI.

Book a free 30-minute call

We figure out what you need, where AI fits in, and what working together would look like.

Book the call →

Or take the 30-second calculator

You’ll see the hours and the money quietly leaking out of your week, and the three workflows worth building first.

Take the calculator →

Or grab the free AI resource library

Prompt packs, templates, checklists, and swipe files. The exact tools I build for paying clients. Yours, free.

Get the library →
Keep reading

More from the blog.