AWS CDK vs Terraform
AWS CDK
aws.amazon.comTerraform
developer.hashicorp.comSide by side
| Figure | AWS CDK | Terraform |
|---|---|---|
| Price from | Free | $0.10/mo |
| Free plan | Yes | Yes |
| Free trial | — | Yes |
| Open source | — | — |
| Web | — | Yes |
| Windows | Yes | Yes |
| macOS | Yes | Yes |
| Linux | Yes | Yes |
| API | — | Yes |
| Self-hosted | — | Yes |
| Plans published | 1 | 10 |
| Spec score · Infrastructure as Code Tools | 8.0 (#7) | 8.7 (#3) |
| Spec score · Infrastructure Automation | 8.0 (#10) | 8.7 (#6) |
| Purpose | AWS CDK lets you define cloud application resources using familiar programming languages. | Terraform is an infrastructure-as-code tool for defining, provisioning, and managing cloud and on-premises resources through human-readable configuration files. |
| Security limitation | CDK cannot guarantee that custom constructs enforce compliance because general-purpose code can bypass their checks. | HashiCorp warns that malicious providers, modules, and run tasks can exfiltrate sensitive configuration or plan data, and policy enforcement is not a security boundary. |
Plans
Terraform
- FreeFree
- StandardPriced on request
- PremiumPriced on request
- HCP Terraform FreeFree
- Terraform Community EditionFree
- HCP Terraform Essentials$0.10 a month
- HCP Terraform Standard$0.47 a month
- HCP Terraform Premium$0.99 a month
- EssentialsPrice not published
- Terraform EnterprisePriced on request
In their own words
AWS CDK
AWS CDK is a framework for defining AWS cloud application infrastructure with familiar programming languages and deploying it through AWS CloudFormation. Stable bindings are available for TypeScript, JavaScript, Python, Java, C#/.NET, and Go. The AWS Construct Library supplies reusable constructs for AWS services and features. CDK Pipelines supports CI/CD deployment to testing, integration, and production environments. In Visual Studio Code, the AWS CDK Explorer preview can browse projects, stacks, resources, and policies. The tool supports AWS only and provides managed state, policy as code, drift detection, importing existing resources, and self-hosted execution. CDK itself has no charge, although deployed AWS resources may incur charges. Developers need Node.js 22.x or later regardless of application language. Deployments use configured AWS credentials and IAM roles. AWS recommends IAM security practices, and custom constructs cannot guarantee compliance because general-purpose code can bypass their checks.
Terraform
Terraform is an infrastructure-as-code tool for defining, provisioning, and managing cloud and on-premises resources through human-readable configuration files. Its core process is to write a configuration, review an execution plan, then apply approved changes. Providers connect Terraform to services through APIs, and the Terraform Registry lists providers for AWS, Azure, Google Cloud, Kubernetes, GitHub, and Splunk. Modules package reusable infrastructure configurations that users can find or publish in the Registry. The free Community Edition is a downloadable command-line tool. HCP Terraform adds remote execution, repository connections to GitHub, GitLab, and Bitbucket that can trigger plans after changes, and an API. It stores state remotely with encryption at rest and offers workspaces, single sign-on, and role-based access controls. HCP Terraform and Terraform Enterprise support Sentinel policies. HashiCorp cautions that policy-as-code is a guardrail, not a security boundary, and trusted providers and modules matter because they can access workspace variables and state. Downloads are available for Windows, macOS, and Linux.