Skip to main content
CloudBit Logo
Cloud

Terraform, CloudFormation or CDK: which one to choose for your AWS infrastructure

All three describe infrastructure as code, but they differ in language, scope and workflow. A practical guide to decide.

· 7 min read · CloudBit team

Three approaches to the same problem

CloudFormation is AWS's native service: you write YAML or JSON templates and AWS manages state and execution. Terraform is a multi-provider tool with its own language (HCL) and a state file managed by the team. AWS CDK lets you define infrastructure in TypeScript, Python or other languages and generates CloudFormation templates under the hood.

When CloudFormation makes sense

If all your infrastructure is on AWS and you want the provider itself to manage state, rollbacks and integration with services like Service Catalog or StackSets for many accounts, CloudFormation is a solid choice at no extra cost.

Its main drawbacks are verbose templates and AWS-only scope: external DNS, monitoring or your code repository stay outside.

When Terraform makes sense

When the platform combines AWS with other services (Cloudflare, Datadog, GitHub, another cloud) or the team already knows HCL, Terraform lets you manage everything with one tool and one review workflow.

In exchange, the team owns the state file: where it lives, how it is locked and who has access.

When CDK makes sense

CDK shines when developers want to define infrastructure in the same language as the application, with reusable abstractions, typing and unit tests. It is very productive for serverless and container applications on AWS.

Keep in mind the end result is CloudFormation: CloudFormation limits and deployment times still apply.

Our recommendation

For most companies using several tools besides AWS, Terraform is the most flexible starting point. For development teams that live on AWS and prefer to code, CDK. For organizations with many accounts and strong central governance, CloudFormation with StackSets.

What matters is not the tool but the process: every infrastructure change versioned, reviewed and applied from a pipeline.

Want to apply this at your company?

Book a free 30-minute technical consultation.

Talk to a specialist