AWS ECS/EKS
ECS and EKS are AWS's two managed container orchestration options. ECS (Elastic Container Service) is AWS-native with a simpler operational model; EKS (Elastic Kubernetes Service) is managed Kubernetes — more portability and ecosystem power, but more complexity. Both can run on Fargate (serverless containers) or on EC2 instances you manage.
The guiding principle: don't reach for orchestration just because you have "containers." If a managed PaaS or serverless option fits, it's often simpler. When you do need orchestration, start with ECS unless you specifically need Kubernetes.
TL;DR
- Start with ECS (often on Fargate) unless you explicitly need Kubernetes.
- Choose EKS for Kubernetes APIs, multi-team platform features, or existing K8s investment.
- Don't pick either just for "containers" — managed PaaS/serverless may be simpler.
- Keep services stateless; push state to managed databases/caches.
Quick Example
An ECS task definition describes how to run a container; a service keeps N of them running:
ECS Concepts
- Task Definition — how to run a container (image, CPU/memory, env vars, ports).
- Task — a running instance of a task definition.
- Service — keeps N tasks running and performs rolling updates.
- Cluster — the logical grouping of tasks/services.
Fargate vs EC2 launch type
- Fargate — serverless compute for containers; AWS manages the hosts, you just run tasks. Less ops.
- EC2 — you manage the underlying instances; more control (and more responsibility).
EKS Concepts
EKS gives you full Kubernetes primitives — deployments, services, ingresses, namespaces, RBAC, autoscaling, and scheduling. But you still own significant operations: cluster upgrades, node group management (unless using Fargate/serverless nodes), and observability. See Kubernetes.
When to Use Which
Choose ECS when your workload is straightforward microservices, you value AWS integration and simplicity, and you want fewer moving parts than Kubernetes.
Choose EKS when you need Kubernetes features and ecosystem (service mesh, operators, Helm), want cross-cloud portability (at the cost of complexity), and have platform engineers to run it well.
Best Practices
- Keep services stateless — push state into managed databases/caches.
- Use an image registry (ECR) with immutable tags (no
:latestin production). - Design safe rollouts — health checks and gradual/blue-green deployments.
- Set realistic CPU/memory limits to avoid OOM kills and noisy-neighbor issues.
- Plan logs, metrics, and traces from day one. See Logging.
Common Mistakes
Wrong resource limits
Reaching for EKS by default
FAQ
ECS or EKS — which should I start with?
Start with ECS, ideally on Fargate. It covers the majority of microservice workloads with far less operational overhead than Kubernetes. Move to EKS when you specifically need Kubernetes APIs and ecosystem (operators, service mesh, Helm charts), want multi-cloud portability, or your team already runs Kubernetes elsewhere.
What's the difference between Fargate and the EC2 launch type?
Fargate is serverless: AWS provisions and manages the compute hosts, you just define and run tasks, and you pay per task's vCPU/memory. The EC2 launch type means you run and manage a fleet of EC2 instances that host your containers — more control over the hardware and potentially lower cost at scale, but you own patching and capacity. Most teams start with Fargate.
Do I even need ECS or EKS?
Not always. If your app fits a managed PaaS (App Runner, Cloud Run) or serverless (Lambda), those are simpler and need no orchestrator. Reach for ECS/EKS when you have multiple long-running containerized services that need orchestration, service discovery, and controlled rollouts.
Who owns cluster upgrades on EKS?
You do (the control plane is managed, but worker nodes and add-ons aren't, unless you use Fargate profiles). Unclear ownership of EKS upgrades is a common operational gap — assign it explicitly, keep Kubernetes versions current, and test upgrades in a non-prod cluster first.
Related Topics
- Cloud Computing — The hub
- Kubernetes — The orchestrator behind EKS
- Docker — Building container images
- Google Cloud Run — Serverless containers alternative
- Microservices — Service decomposition