Terraform Cost Optimization for AWS - Reduce Your Cloud Bill
Practical Terraform patterns to reduce AWS costs: right-sizing, spot instances, scheduling, and reserved capacity. Step-by-step guide with code examples and ...
Guides
Terraform vs CloudFormation vs Pulumi: features, language support, multi-cloud, state management, and when to use each IaC tool. Side-by-side comparison.
| Criterion | Terraform | CloudFormation | Pulumi |
|---|---|---|---|
| Language | HCL | YAML / JSON | TypeScript / Python / Go / C# / Java |
| Cloud support | Multi-cloud | AWS only | Multi-cloud |
| State | Self-managed | AWS-managed | Pulumi Cloud / self-managed |
| Reuse | Modules | Nested stacks | Components / packages |
| Best for | HCL standardisation, multi-cloud | Pure AWS shops | Programming-language workflows |
Terraform for multi-cloud and the largest ecosystem. CloudFormation if you're 100% AWS and want native integration. Pulumi if your team prefers Python/TypeScript over DSLs. All three are production-ready.
| Feature | Terraform | CloudFormation | Pulumi |
|---|---|---|---|
| Language | HCL (DSL) | JSON/YAML | Python, TypeScript, Go, C# |
| Multi-cloud | ✅ AWS, Azure, GCP, 3000+ providers | ❌ AWS only | ✅ AWS, Azure, GCP, K8s |
| State | Self-managed (S3, etc.) or TF Cloud | AWS-managed (free) | Pulumi Cloud or self-managed |
| Plan/preview | terraform plan | Change sets | pulumi preview |
| Drift detection | terraform plan (on demand) | Drift detection (built-in) | pulumi refresh |
| Learning curve | Low (HCL is simple) | Medium (verbose YAML) | Depends on language skill |
| Community | Largest | AWS-focused | Growing |
| Cost | Free (open source) + paid Cloud | Free | Free + paid Cloud |
| Modules/reuse | Terraform Registry | Nested stacks, modules | NPM/PyPI packages |
resource "aws_s3_bucket" "data" {
bucket = "my-data-bucket"
}
resource "aws_s3_bucket_versioning" "data" {
bucket = aws_s3_bucket.data.id
versioning_configuration {
status = "Enabled"
}
}Resources:
DataBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: my-data-bucket
VersioningConfiguration:
Status: Enabledimport pulumi_aws as aws
bucket = aws.s3.Bucket("data",
bucket="my-data-bucket",
versioning=aws.s3.BucketVersioningArgs(
enabled=True,
),
)| Aspect | Terraform | CloudFormation | Pulumi |
|---|---|---|---|
| Where state lives | S3, Azure Blob, GCS, TF Cloud | AWS (automatic) | Pulumi Cloud, S3 |
| Locking | DynamoDB, native | Automatic | Automatic |
| Encryption | Your responsibility | AWS KMS | Your responsibility |
| Cost | Storage costs | Free | Pulumi Cloud (free tier) |
| Backup | S3 versioning | Automatic | Automatic |
# Use cf2tf tool
pip install cf2tf
cf2tf my-stack.yaml > main.tf
# Then import resources with terraform import# Use pulumi convert
pulumi convert --from terraform --out pulumi-projectTerraform wins on multi-cloud and ecosystem size. CloudFormation wins on AWS-native simplicity (zero state management). Pulumi wins for teams who want real programming languages. Pick based on your cloud strategy and team skills — all three are battle-tested in production.
Practical Terraform patterns to reduce AWS costs: right-sizing, spot instances, scheduling, and reserved capacity. Step-by-step guide with code examples and ...
How to achieve zero-downtime deployments with Terraform using blue-green, rolling updates, and create_before_destroy. Step-by-step guide with code examples a...
Complete guide to testing Terraform configurations with terraform test, Terratest, and validation rules. Step-by-step guide with code examples and best pract...
Complete guide to Terraform data sources: querying existing infrastructure, filtering, and common patterns. Step-by-step guide with code examples and best pr...