ECS on Fargate or on EC2: how do you choose?
BeginnerScenarioECS, EKS, Lambda and ECR
Answer
Situation read → Fargate removes host management; EC2 gives control and cost optimization at scale.
What I'd do →
- Choose Fargate for most services, bursty workloads and small teams
- Choose EC2 for GPUs, large steady fleets with Savings Plans, privileged containers or daemon sets
- Use capacity providers to mix both
- Compare per vCPU-hour cost
Why → Fargate trades roughly 20 to 30 percent premium for no patching.
Interview tip → Say "Fargate by default, EC2 when numbers justify".
More on ECS, EKS, Lambda and ECR
Deploy a containerized API on ECS behind an ALB. What are the building blocks?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