Volume 4 · Chapter 5 — Compute and Containers
Container Orchestration: ECS, EKS, and Fargate
5.1 Introduction
Running one container is easy; running hundreds across a fleet - scheduling them, restarting failures, scaling, updating without downtime, networking them together - requires orchestration. AWS offers two orchestrators, ECS and EKS, and a serverless way to run containers, Fargate, that works with both. Choosing among them is a common architecture decision and interview question, because it trades off simplicity, portability, control, and operational overhead. This chapter clarifies what each is and when to use it.
5.2 Why Orchestration
An orchestrator manages containers at scale, handling the work you can’t do by hand across a large fleet: it schedules containers onto hosts based on available resources, restarts containers that fail, scales the number of container instances up and down with demand, handles networking and service discovery so containers can find and talk to each other, distributes load across container instances, and performs rolling updates so you deploy new versions without downtime. In short, orchestration turns a collection of container hosts into a self-healing, scalable platform - the same reliability and elasticity ideas as Auto Scaling, but at the container level and with richer deployment and networking capabilities.
5.3 ECS and EKS
ECS (Elastic Container Service) is AWS’s own container orchestrator - simpler, deeply integrated with AWS, and with less to learn and operate, making it a good choice when you’re all-in on AWS and want the lowest operational overhead. EKS (Elastic Kubernetes Service) is AWS’s managed Kubernetes - it runs the industry-standard Kubernetes orchestrator for you, which is more complex but gives you the huge Kubernetes ecosystem, portability across clouds and on-premises (Kubernetes runs anywhere), and a standard skill set your teams may already have. The trade-off is clear: ECS for simplicity and tight AWS integration; EKS for Kubernetes’ portability, ecosystem, and standardization when you need them or want to avoid lock-in - at the cost of Kubernetes’ greater complexity.
flowchart TB
Q1{Need Kubernetes ecosystem\nor multi-cloud portability?}
Q1 -->|Yes| EKS[EKS - managed Kubernetes\nstandard, portable, richer, more complex]
Q1 -->|No, want simplest AWS-native| ECS[ECS - AWS orchestrator\nsimpler, tightly integrated]
ECS --> Q2{Manage the servers?}
EKS --> Q2
Q2 -->|No, serverless containers| FG[Fargate - no nodes to manage]
Q2 -->|Yes, need node control| EC2n[EC2 launch type - you manage the hosts] 5.4 Fargate: Serverless Containers
Fargate is a launch mode - it works with both ECS and EKS - that runs your containers without you managing the underlying servers at all. Normally you’d run containers on a cluster of EC2 instances that you provision, patch, and scale; with Fargate, AWS runs the containers on infrastructure it manages, so you specify the container’s CPU and memory and AWS handles the hosts. This removes the operational burden of managing, patching, and scaling a node fleet - you focus only on your containers. The trade-off is less control over the underlying hosts and a different cost model. So the second dimension of the decision, after ECS-versus-EKS, is Fargate (no servers to manage) versus the EC2 launch type (you manage the nodes for more control or specific requirements).
5.5 Making the Choice
The decision has two dimensions. First, the orchestrator: ECS if you want the simplest, most AWS-integrated option with the least to operate; EKS if you need Kubernetes’ portability, ecosystem, or standard tooling, or want to avoid cloud lock-in. Second, the compute mode: Fargate if you want serverless containers with no node management, which suits most workloads and minimizes operational overhead; the EC2 launch type if you need control over the hosts, specific instance capabilities, or a cost profile that favours managing your own nodes at scale. Many teams default to Fargate for the reduced operational burden and choose between ECS and EKS based on whether Kubernetes’ benefits justify its complexity - a bank standardizing on Kubernetes across environments picks EKS, while a team wanting simplicity on AWS picks ECS.
5.6 Banking Production Scenario
A bank standardizes on Kubernetes for portability and its team’s existing skills, so it runs its microservices on EKS. To minimize the burden of managing and patching a node fleet, it runs most workloads on Fargate, letting AWS handle the underlying infrastructure while the platform team focuses on the services themselves; for a few workloads with specific host requirements it uses managed EC2 node groups. Each microservice is a scanned, versioned image from ECR, and EKS handles scheduling, self-healing, service discovery, load distribution, and rolling updates across Availability Zones. Pods receive their own IAM roles via service-account association, so each service has least-privilege AWS access with no stored keys. The result is a standardized, portable, self-healing container platform with minimized operational overhead.
5.7 Troubleshooting: Orchestration Issues
Orchestration problems tend to be about scheduling, capacity, and configuration. Containers stuck unable to start (pending) usually mean insufficient cluster capacity to place them - scale the nodes or use Fargate so capacity is provided automatically. Containers restarting repeatedly point to the application failing its health check or crashing on startup - check logs and configuration. Services that can’t reach each other are service-discovery or networking/security issues. Deployments that cause downtime mean the rolling-update or health-check settings aren’t gating properly. Heavy operational toil managing and patching nodes is exactly what Fargate removes. The diagnostic approach is to check whether containers are scheduled and healthy, whether there’s enough capacity, and whether networking and configuration allow services to run and communicate - the orchestrator’s status will point to which.
Compare ECS, EKS, and Fargate. How do you decide which to use?
These address two separate decisions - which orchestrator, and which compute mode - so I treat them as two dimensions rather than one list. First the orchestrator. ECS, Elastic Container Service, is AWS’s own container orchestrator: it’s simpler, deeply integrated with the rest of AWS, and has less to learn and operate, which makes it a strong choice when you’re committed to AWS and want the lowest operational overhead. EKS, Elastic Kubernetes Service, is AWS’s managed Kubernetes: it runs the industry-standard Kubernetes orchestrator for you, which is more complex but gives you the large Kubernetes ecosystem, portability across clouds and on-premises since Kubernetes runs anywhere, and a standard, widely-known skill set - so you choose EKS when you need that portability or ecosystem, want to avoid cloud lock-in, or your teams already know Kubernetes, accepting its greater complexity in return. Both orchestrators do the core job of running containers at scale: scheduling them onto hosts, restarting failures, scaling, service discovery, load distribution, and rolling updates. The second dimension is Fargate versus the EC2 launch type, and Fargate works with both ECS and EKS. Fargate is a serverless mode that runs your containers without you managing the underlying servers at all - you specify the container’s CPU and memory and AWS provisions, patches, and scales the infrastructure, removing the operational burden of running a node fleet; the trade-off is less control over the hosts and a different cost model. The EC2 launch type means you manage the cluster’s instances yourself, which you’d choose when you need control over the hosts, specific instance capabilities, or a cost profile that favours managing your own nodes at scale. So I decide like this: pick ECS for the simplest, most AWS-native option with the least to operate, or EKS if I need Kubernetes’ portability, ecosystem, or standardization - a bank standardizing on Kubernetes across environments picks EKS, a team wanting simplicity picks ECS. Then, independently, I default to Fargate to eliminate node management for most workloads, and use the EC2 launch type only where I need host-level control or a specific cost or capability profile. The two questions - orchestrator (simplicity/integration vs portability/ecosystem) and compute mode (serverless vs self-managed nodes) - together give a clean decision rather than a false either/or.
Chapter Revision Notes
- Orchestration runs containers at scale: scheduling, self-healing restarts, scaling, service discovery, load distribution, rolling updates.
- ECS: AWS-native, simpler, tightly integrated - lowest operational overhead when all-in on AWS.
- EKS: managed Kubernetes - portable, huge ecosystem, standard skills, avoids lock-in, but more complex.
- Fargate: serverless containers (works with ECS and EKS) - no node fleet to manage, at the cost of host control.
- Decide in two dimensions: orchestrator (ECS vs EKS) and compute mode (Fargate vs EC2 launch type); many default to Fargate.