DEV Community

Terraform vs AWS CDK vs CloudFormation: The Definitive IaC Decision Guide for 2026

Every AWS team eventually asks: "Should we use Terraform, CDK, or CloudFormation?" The answer isn't universal - it depends on your team's skills, organizational constraints, multi-cloud requirements, and how you want to manage infrastructure lifecycle. This guide compares all three across the dimensions that actually matter in production, with a decision framework to help you choose. The Three Models at a Glance โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ INFRASTRUCTURE AS CODE โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ CloudFormation โ”‚ AWS CDK โ”‚ Terraform โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Declarative โ”‚ Imperative โ”‚ Declarative โ”‚ โ”‚ JSON/YAML โ”‚ TypeScript/ โ”‚ HCL โ”‚ โ”‚ โ”‚ Python/Java/Go โ”‚ โ”‚ โ”‚ AWS-native โ”‚ Synthesizes to โ”‚ Multi-cloud โ”‚ โ”‚ โ”‚ CloudFormation โ”‚ (4000+ providers) โ”‚ โ”‚ No state file โ”‚ No state file โ”‚ State file required โ”‚ โ”‚ (AWS manages) โ”‚ (AWS manages) โ”‚ (you manage) โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ CloudFormation: The AWS Native What it is: AWS's own IaC service. Declarative JSON/YAML templates that describe desired state. AWS handles provisioning, ordering, and rollback. Strengths - Zero setup - no tools to install, no state to manage - Same-day AWS support - new services/features available immediately in CloudFormation - Drift detection - detects when resources deviate from template - Stack operations - create, update, delete as atomic operations with automatic rollback - StackSets - deploy across multiple accounts and regions from one template - Change sets - preview changes before applying - No state file - AWS tracks resource state internally (no S3 backend, no locking concerns) Weaknesses - Verbose - simple resources require many lines of YAML/JSON - No loops or conditionals (limited) - Conditions andFn::ForEach are awkward - No abstraction - can't create reusable "classes" of infrastructure - AWS-only - cannot manage non-AWS resources - Slow updates - large stacks take 30+ minutes to update - Error messages - often cryptic, debugging is painful Best For - Teams deeply committed to AWS with no multi-cloud plans - Organizations using AWS Service Catalog (backed by CloudFormation) - Landing Zone Accelerator (LZA) deployments - Simple, single-account deployments with marginal benefit) Migration Considerations | From | To | Effort | When It Makes Sense | |---|---|---|---| | CloudFormation โ†’ CDK | Low | CDK can import existing CFN stacks. Migrate incrementally. | | | CloudFormation โ†’ Terraform | Medium | Use terraform import . Re-create templates in HCL. | | | Terraform โ†’ CDK | High | No migration path. Must re-create and import. | | | CDK โ†’ Terraform | High | No migration path. Must re-create and import. | Key rule: Don't migrate for marginal gains. Only migrate when the current tool is actively blocking you (e.g., multi-cloud requirement, team can't hire CloudFormation skills). What About Pulumi / CDKTF / Crossplane? | Tool | Niche | |---|---| | Pulumi | Like CDK but multi-cloud. Real languages + any cloud provider. Consider if you want CDK-style + multi-cloud. | | CDKTF (CDK for Terraform) | Write CDK-style code that synthesizes to Terraform HCL. Best of both worlds - but adds complexity. | | Crossplane | Kubernetes-native IaC. Manages cloud resources via K8s CRDs. For teams running everything on Kubernetes. | Summary | Choose... | When... | |---|---| | CloudFormation | AWS-only, simple deployments, no state management overhead, same-day feature support | | CDK | Developer teams, need reusable constructs, want type safety and testing, AWS-only is fine | | Terraform | Multi-cloud, platform teams, large module ecosystem, existing HCL expertise, non-AWS resources | The "wrong" choice isn't which tool you pick - it's switching tools every 6 months because someone read a blog post. Pick one, standardize, and build expertise. The best IaC tool is the one your team uses consistently. Alpesh Kumbhare is an AWS Architect at Atos, specializing in AWS infrastructure automation and IaC best practices. Connect on LinkedIn. Top comments (0)

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.