ECS Fargate Service Stack
CloudFormation: Fargate service with ALB, target tracking autoscaling, Secrets Manager integration, and structured CloudWatch logging.
Production Fargate Service Without the Boilerplate
Running a containerized service on ECS Fargate requires more CloudFormation than you expect — task definitions, execution roles, target groups, listener rules, log groups, and autoscaling policies. This stack gives you all of it wired together and ready to deploy your container.
What's Deployed
- ECS Cluster and Fargate task definition (CPU/memory parameterized)
- Application Load Balancer with HTTPS listener and ACM certificate
- Target tracking autoscaling on CPU and memory utilization
- Secrets Manager integration — secrets injected as environment variables at runtime
- CloudWatch Log Group with structured JSON logging config
- IAM execution role and task role with least-privilege policies
- Security groups for ALB and task with correct traffic rules
Deploying Your Container
aws cloudformation deploy --template-file fargate-service.yaml \n --stack-name my-service \n --parameter-overrides \n Image=123456789.dkr.ecr.us-east-1.amazonaws.com/my-app:latest \n DomainName=api.example.com
Included Files
fargate-service.yaml— full CloudFormation templatetask-definition-example.json— annotated task definition referenceREADME.md— parameter reference, secrets setup, scaling tuning guide