Terraform vs CloudFormation for startups: which one to pick
Terraform or CloudFormation for an AWS startup? Cost, state, previews, drift and licence compared, with commands for each and a clear rule for choosing.

Short answer: If everything you run is on AWS and you have nobody who already knows Terraform, CloudFormation is the lower-effort choice: it is free, AWS stores the state, and there is nothing extra to secure. If you manage anything beyond AWS, want modules you fully control, or already have people who know HCL, pick Terraform. Both preview changes before applying them and both can detect drift, so the features are closer than the internet arguments suggest. The real difference is what you have to operate around the tool.
I use Terraform for client work, so you should know where I lean. But the right answer depends on the team, and I have seen CloudFormation be the correct pick. This post compares the two on cost, state, previews, drift, limits and licence, with the commands for each, and ends with a short rule for choosing.
Everything below comes from the official AWS and HashiCorp documentation linked in each section, checked in November 2026. I checked every AWS CLI command and flag below against the AWS CLI’s own argument parser, but I did not run them against a live account for this post, so test each one in a sandbox stack first.
The comparison in one table
| Terraform | CloudFormation | |
|---|---|---|
| Cost of the tool | CLI is free. HCP Terraform (hosted) is optional and billed per managed resource | $0 for AWS resource types. Per-operation charge for third-party extensions and custom hooks |
| Where state lives | A state file you store and lock yourself (usually S3) | Inside AWS, as a stack. You do not manage it |
| Preview before apply | terraform plan |
Change sets |
| Drift detection | terraform plan shows differences from real infrastructure |
Built-in stack drift detection, with documented gaps |
| Providers | AWS, plus GitHub, Cloudflare, Datadog and thousands more | AWS resources, plus registry extensions |
| Language | HCL | YAML or JSON |
| Failed apply | Does not roll back a partially completed apply | Stack-level failure handling, with options to roll back or keep what was created |
| Multi-account | Provider aliases and your own pipeline | StackSets |
| Hard limits | No fixed resource cap in the docs I read | 500 resources per template; use nested stacks beyond that |
| Licence | Business Source License 1.1 (version 1.6.0 and later) | AWS service, no licence to manage |
The rest of the post explains the rows that matter.
Cost: what each one actually bills
For a small team, both tools are close to free. The cost shows up in the details.
CloudFormation. The CloudFormation pricing page says there is no additional charge for using CloudFormation with resource providers in the AWS:: and Alexa:: namespaces. You pay for the EC2 instances, load balancers and databases it creates, the same as if you had created them by hand. Charges only appear if you use registry extensions or custom hooks, which are billed per handler operation (create, update, delete, read or list). The page’s worked examples use $0.0009 per operation with a free allowance, and the first 30 seconds of each operation are free, then $0.00008 per second.
Terraform CLI. The command-line tool costs nothing. What you pay for is the S3 bucket that holds state, which is pennies for a small account (see Terraform S3 backend with KMS and locking), and whatever runs your pipeline, for example GitHub Actions minutes.
HCP Terraform. This is HashiCorp’s hosted service, and it is optional. The HCP Terraform overview lists free, Essentials, Standard and Premium plans, and says free organizations are limited to 500 managed resources. HashiCorp’s own cost estimate page gives a flat rate of $0.0001359 per managed resource per hour for Standard Edition on pay-as-you-go billing, with the first 500 free each month. A managed resource is a resource in the state file in managed mode, so data sources, null_resource and terraform_data do not count. Using that formula at 720 hours a month:
| Managed resources | Billed resources | Monthly cost (Standard, pay-as-you-go) |
|---|---|---|
| 100 | 0 | $0 |
| 500 | 0 | $0 |
| 750 | 250 | $24.46 |
| 1,000 | 500 | $48.92 |
The 1,000-resource figure matches HashiCorp’s own worked example. The 750 row is the same formula applied by me. HashiCorp’s pages use different plan names in different places and I could not find a public rate for the Essentials plan, so check the current HashiCorp pricing before you budget. The point for a startup is that you do not need HCP Terraform to use Terraform. A bucket and a GitHub Actions workflow are enough.
State: the biggest practical difference
This is the row that decides most real projects.
CloudFormation keeps its record of what it built inside AWS. You never create a state bucket, never worry about a stuck lock, and never lose a state file. Nothing to secure and nothing to back up.
Terraform keeps a state file that you store and protect. That is more work, and state can contain secrets in plain text, which is why the S3 backend should be encrypted, versioned and locked. The same applies to saved plan files: the terraform plan documentation warns that sensitive values are saved in cleartext in the plan file. If a lock gets stuck or state is damaged, you also need to know how to recover it. I wrote that up in How to unlock Terraform state and recover it.
None of this is hard once it is set up, and it is the first thing I put in place on every Terraform project. But it is a real cost that CloudFormation does not have. If nobody on the team wants to own it, that counts in CloudFormation’s favour.
Previewing a change: plan vs change sets
Both tools can show you what will change before it changes. This is the feature that makes infrastructure as code safe, and both have it.
Terraform. In automation, save the plan and apply exactly that file:
terraform plan -out=tfplan -detailed-exitcode
terraform apply tfplan
The plan documentation describes -out as writing the plan to a file you can later pass to terraform apply, and -detailed-exitcode returns 0 for no changes, 1 for an error and 2 when there are changes. The apply documentation says that when you pass a saved plan, Terraform runs it without asking for confirmation, because passing the file counts as the approval. So the review has to happen before that command, for example in a pull request.
CloudFormation. The same idea is called a change set. The change sets documentation says they let you preview how proposed changes might affect running resources, and that CloudFormation changes the stack only when you execute the change set:
aws cloudformation create-change-set \
--stack-name my-app \
--change-set-name add-queue \
--template-body file://template.yaml
aws cloudformation describe-change-set \
--stack-name my-app \
--change-set-name add-queue
aws cloudformation execute-change-set \
--stack-name my-app \
--change-set-name add-queue
--stack-name and --change-set-name are the required options on create-change-set in the CLI reference, plus exactly one of --template-body, --template-url or --use-previous-template. One honest caveat from the AWS page: a change set does not guarantee the update will succeed. Validation happens when you create it, but a failure can still occur at execution time.
Terraform’s plan output is easier to read in a pull request, and that is a large part of why teams prefer it. CloudFormation’s change set works, but it takes more clicks or more scripting to put it in front of a reviewer.
When an apply fails halfway
Terraform’s apply documentation is blunt: Terraform does not automatically roll back a partially completed apply. You fix the cause and run it again, and the resources that were created stay in state.
CloudFormation manages failures at the stack level. The stack failure options page describes an option to preserve successfully provisioned resources, enabled with --disable-rollback on create-stack, update-stack and execute-change-set, or --on-stack-failure DO_NOTHING on create-change-set. Read that page before you use it, because it also lists cases where the option is not supported. I am not stating the default behaviour here, because AWS’s pages describe it differently for different features. Test a failing change in a throwaway stack so you know what your own setup does.
Drift: when someone changes things by hand
Drift is the difference between what your code says and what exists. It happens when someone fixes an incident in the console and never updates the code.
CloudFormation has it built in:
aws cloudformation detect-stack-drift --stack-name my-app
aws cloudformation describe-stack-resource-drifts --stack-name my-app
detect-stack-drift returns a detection ID, and the second command lists the drift per resource (it only includes resources that have been checked, so run detection first). The drift detection page lists real gaps you should know about. It only checks properties that are explicitly set in the template. It does not check nested stacks (you run it on the nested stack directly). Resource types that do not support it get a status of NOT_CHECKED, and some values, such as Lambda function code, are never checked.
Terraform finds drift whenever you run terraform plan, because it refreshes against the real resources. It has no separate drift feature, so teams run a scheduled plan: see Terraform drift detection with GitHub Actions.
Getting existing infrastructure under code
Most startups do not start from nothing. The account was built in the console, and the question is how to bring it under code.
Terraform imports resources one at a time into state and you write the matching code. I covered the process in Import existing AWS resources into Terraform.
CloudFormation has a more automatic option. The IaC generator documentation says it can generate a template from resources in your account that CloudFormation does not already manage. The scan is region-wide and expires after 30 days, one template can model up to 500 resources, and it only supports resources that Cloud Control API supports in your Region. It is a good start for a messy account, but you still need to review and clean the output.
Limits and multi-account
CloudFormation has hard quotas. The quotas page lists 500 resources per template (split into nested stacks past that), 200 parameters, and a 51,200-byte limit for a template body passed inline, or 1 MB from S3. A startup rarely reaches these, but a single large stack that holds everything will.
For several AWS accounts, CloudFormation StackSets let you create, update or delete stacks across multiple accounts and Regions from one administrator account, as the StackSets documentation puts it. With Terraform you do the same with provider aliases or one pipeline run per account, which is more flexible and more to build. CloudFormation also has Git sync, where committing a changed template to a connected repository updates the stack, with optional pull request comments describing the change.
The licence question
In August 2023 HashiCorp moved Terraform from the Mozilla Public License to the Business Source License. The current LICENSE file in the Terraform repository names the Business Source License 1.1, IBM as the licensor, and Terraform 1.6.0 or later as the licensed work, with a change date four years after each version is published, after which it converts to MPL 2.0. For a startup managing its own infrastructure this changes nothing, because the restriction is on building a competing product. If it still bothers you, read OpenTofu vs Terraform in 2026. CloudFormation has no licence question at all.
How to choose
Answer these in order and stop at the first yes.
- Do you manage anything that is not AWS, now or soon? GitHub repositories, Cloudflare DNS, Datadog monitors, a database provider. If yes, choose Terraform. One tool and one workflow beat two.
- Does someone on the team already know Terraform well? If yes, choose Terraform. The best tool is the one your team can review.
- Is it AWS only, and does nobody want to own state and pipelines? Choose CloudFormation. You get previews, drift detection and rollback handling with nothing extra to run.
- Do you need many accounts with the same baseline? CloudFormation StackSets are the shortest path, and Terraform is the most flexible path. Decide by who maintains it.
- Still unsure? Choose Terraform and keep to one tool, so the team learns one language. Whatever you pick, do not run both tools on the same resources.
My bias is toward Terraform because most clients end up with something outside AWS within a year, and because plan output in a pull request is a good review habit. If you pick CloudFormation, you are not making a mistake. The mistake is staying in the console with no code at all.
Want help setting it up?
If you are choosing a tool or already have a console-built account to bring under code, I can do it for you. The Terraform consulting service covers remote state, reusable modules and plan reviews in pull requests. For a worked example of a full setup, see the ECS Fargate case study. And if you want to start with what your account looks like today, send it in for a Free AWS Review.
Prices, limits and licence terms are from the official AWS and HashiCorp pages linked above, checked in November 2026. They change, so confirm them before you decide.
Common questions
Is Terraform better than CloudFormation?
Neither is better in general. CloudFormation is the simpler choice when everything you run is on AWS, because AWS keeps the state for you and the tool itself is free. Terraform is the better choice when you manage more than AWS, or when you want reusable modules and plan output reviewed in pull requests. For most small AWS-only teams the difference matters less than doing infrastructure as code at all.
Is CloudFormation free?
For AWS resource types, yes. AWS says there is no additional charge for using CloudFormation with resource providers in the AWS:: namespaces; you pay only for the resources it creates. Third-party extensions and custom hooks are billed per handler operation, at $0.0009 per operation in AWS's own pricing examples, with a free allowance.
Is Terraform still free to use?
The Terraform command-line tool is free to download and run. Since version 1.6.0 it is under the Business Source License 1.1, which restricts using it to build a competing product but allows managing your own infrastructure. The paid part is HCP Terraform, HashiCorp's hosted service, which has a free tier of 500 managed resources.
Can I use both Terraform and CloudFormation?
Yes, and many teams do. A common split is Terraform for the main infrastructure and CloudFormation for things AWS ships as CloudFormation templates, such as some account-wide setups. Keep one owner per resource, because two tools managing the same resource will fight each other.
Can I move from CloudFormation to Terraform later?
Yes, but it is real work. Terraform can import existing resources into its state, and you write the matching code. The CloudFormation side has the opposite tool: the IaC generator can scan your account and produce a template from resources it does not manage yet. Plan for a resource-by-resource migration rather than a switch.
Want this set up for your team?
I build this kind of infrastructure for startups and small teams, with fixed prices and full handover.