Deploy containerized applications on AWS ECS Fargate — no servers to manage. Includes auto-scaling, deployment circuit breaker, CloudWatch logging, and secrets support.
- Serverless containers — No EC2 instances to manage
- Auto-scaling — CPU-based target tracking
- Circuit breaker — Auto-rollback on failed deployments
- Secrets — AWS Secrets Manager / SSM Parameter Store integration
- Logging — CloudWatch Logs with configurable retention
- ALB ready — Optional load balancer integration
- Container Insights — ECS monitoring enabled by default
module "api" {
source = "github.com/akshayghalme/terraform-ecs-fargate-service"
cluster_name = "my-cluster"
service_name = "api"
vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnet_ids
container_image = "123456789.dkr.ecr.us-east-1.amazonaws.com/api:latest"
container_port = 8080
cpu = 512
memory = 1024
desired_count = 2
environment_variables = {
NODE_ENV = "production"
PORT = "8080"
}
enable_autoscaling = true
min_count = 2
max_count = 10
tags = { Environment = "production" }
}| CPU | Memory | Monthly (1 task, 24/7) |
|---|---|---|
| 256 (.25 vCPU) | 512 MB | ~$9.40 |
| 512 (.5 vCPU) | 1 GB | ~$18.80 |
| 1024 (1 vCPU) | 2 GB | ~$37.60 |
| 2048 (2 vCPU) | 4 GB | ~$75.20 |
MIT
Akshay Ghalme — akshayghalme.com