Deploy a containerized API on ECS behind an ALB. What are the building blocks?
BeginnerScenarioECS, EKS, Lambda and ECR
Answer
Situation read → Task definition, service, target group, ALB.
What I'd do →
- Push the image to ECR
- Register the task definition with
awsvpcnetwork mode, CPU and memory, log driverawslogs, and task role - Create a service with desired count 3 across subnets and attach it to the ALB target group (IP type)
- Configure health check path and deployment circuit breaker
aws ecs update-service --cluster prod --service api --force-new-deployment
Why → The task role grants app permissions, the execution role lets ECS pull images and write logs.
Interview tip → Know task role versus execution role.
More on ECS, EKS, Lambda and ECR
ECS on Fargate or on EC2: how do you choose?BeginnerAn ECS service deployment is stuck, tasks start and stop repeatedly. How do you debug?IntermediateRoll out a new ECS service version with canary and automatic rollback.IntermediateEKS pods need access to S3 without node-level permissions. How?IntermediateUpgrade an EKS cluster from 1.31 to 1.33 safely.IntermediateDesign node scaling for EKS with mixed Spot and On-Demand and fast scale-up.Advanced