Terraform vs CloudFormation
CloudFormation is AWS's own IaC service: declarative templates, state managed by AWS, and no service fee. If your world is entirely AWS, it removes both the license question and the platform bill. Here's the honest head-to-head.
Pick CloudFormation (or AWS CDK on top of it) if you're AWS-only and want zero extra licensing, vendors or platforms — it's free, supported by AWS, and compliance teams like it. Pick Terraform or OpenTofu if you touch anything beyond AWS — a second cloud, Cloudflare, Datadog, GitHub — or want faster deployments and no 500-resource stack cap. Multi-cloud reality, not preference, usually decides this one.
Side by side
Terraform vs AWS CloudFormation
| Terraform | AWS CloudFormation | |
|---|---|---|
| Scope | ✓ Multi-cloud + thousands of SaaS providers | ✗ AWS only |
| Cost | CLI free (BSL); HCP $0.10–$0.99/resource/mo | Free for AWS resources (3rd-party types/hooks billed) |
| Language | HCL | JSON / YAML (or CDK languages on top) |
| State | Your backend (S3 etc.) or HCP | Managed by AWS — nothing to host or secure |
| Drift detection | On plan / paid platform features | ✓ built into the service |
| Scale limits | No hard per-config cap | 500 resources per stack; nested stacks beyond |
| Speed on big changes | ✓ generally faster applies | Large stacks deploy slowly |
| Rollback | No automatic rollback (fix forward) | ✓ automatic rollback on failure |
| License | BSL 1.1 (OpenTofu: MPL-2.0) | Proprietary AWS service |
Sources: CloudFormation pricing · CloudFormation quotas · HCP Terraform pricing. Compiled July 2026.
A fair call
Which one fits you
Choose CloudFormation if…
- You're AWS-only and expect to stay that way.
- Compliance prefers a first-party, fully managed service with no extra vendor.
- You want automatic rollback and built-in drift detection without a platform bill.
- Your developers would rather write CDK code than learn HCL.
Choose Terraform / OpenTofu if…
- You manage anything beyond AWS — a second cloud, DNS, monitoring, Git platforms.
- You're bumping into the 500-resource stack cap or slow stack deployments.
- You want one language and one workflow across every environment.
- Portability of skills and modules across employers/clouds matters.
Common questions
Terraform vs CloudFormation — common questions
Is CloudFormation free?
Effectively yes for standard use. AWS doesn't charge for the CloudFormation service when you manage AWS resources — you pay only for the resources your stacks create. Charges apply for third-party resource types and for hook invocations beyond the free allowance. That makes it cheaper than any managed Terraform platform for AWS-only estates.
What is the CloudFormation 500-resource limit?
A single CloudFormation stack can contain at most 500 resources. Larger systems must be split across nested stacks or multiple stacks, which adds orchestration complexity. Terraform and OpenTofu have no equivalent hard cap per configuration, though very large states bring their own performance considerations.
Should AWS-only teams use Terraform or CloudFormation?
If you're certain you'll stay AWS-only, CloudFormation (or the CDK on top of it) is free, fully supported by AWS, and integrates tightly with services like Service Catalog and Control Tower. Terraform or OpenTofu is the better pick if there's any chance of a second cloud or of managing SaaS resources — the provider ecosystem covers thousands of services — or if your team already knows HCL. Many AWS shops run both: CloudFormation where AWS mandates it, Terraform for everything else.