Skip to content
Visual explainer 2h 30m to learn 5 steps

Decide between EKS and ECS for a container workload

Compare EKS, ECS and their compute options on operations, workload identity and scaling, and say when the extra control is worth it.

By Invicly Tech, , in AWS Cloud Engineering. About 11 minutes to read.

Topic 12 of 38

In short

Amazon ECS and Amazon EKS both run containers on AWS, but they make different trade-offs. ECS is an AWS-native orchestrator with no control plane to pay for or upgrade, while EKS runs upstream Kubernetes, which brings its huge tool ecosystem and portability along with more moving parts. The right choice depends less on the workload than on the team that has to run it.

Think of it like this: ECS is a company car with servicing included; EKS is a kit car you can tune endlessly, as long as someone in the team enjoys maintaining it.

Explained simply

AWS has two main ways to run containers at scale. Amazon ECS is AWS's own system. Amazon EKS runs Kubernetes, the popular open-source container platform, with AWS managing its control plane. Both can run the same container image on the same Fargate or EC2 compute.

The difference is how much you have to run and learn. ECS has a small set of concepts and no cluster software to upgrade. EKS gives you the full Kubernetes world, including Helm charts, operators and tools that work on any cloud, but you must keep up with Kubernetes versions and add-ons.

Both give each workload its own AWS identity. In ECS that is the task role. In EKS you link a Kubernetes service account to an IAM role with EKS Pod Identity, so pods using that account get the role's permissions.

Neither is better for every case. A small team shipping a few services usually moves faster with ECS. A company that already runs Kubernetes elsewhere, or needs its ecosystem, often gets real value from EKS.

Press Play on a diagram to walk through it one step at a time.

CompareECS and EKS for the same container workload
Amazon ECS
  • No control plane fee or version upgrades
  • Task definitions and services, AWS APIs
  • Task roles for AWS access
  • Service auto scaling and capacity providers
Amazon EKS
  • Hourly fee per cluster, regular Kubernetes upgrades
  • Kubernetes manifests, Helm, operators
  • EKS Pod Identity or IRSA for AWS access
  • HPA plus Karpenter, Cluster Autoscaler or Auto Mode
MapCompute options under each orchestrator
Where containers run
  • ECS
    • Fargate: no servers
    • EC2 capacity provider: your instances
    • ECS Managed Instances: AWS-managed EC2
  • EKS
    • Fargate profiles: no nodes, some limits
    • Managed node groups: AWS-managed EC2 nodes
    • Self-managed nodes
    • EKS Auto Mode: AWS manages nodes and core add-ons
FlowA quick decision path for one team
  1. 1
    Need Kubernetes APIs or tools?

    Helm charts, operators, CRDs, multi-cloud

  2. 2
    Team has Kubernetes skills?

    Someone owns upgrades and add-ons

  3. 3
    Many services or tenants?

    Platform team serving other teams

  4. 4
    If all yes: EKS

    Consider Auto Mode to cut node work

  5. 5
    Otherwise: ECS

    Fargate first, EC2 or Managed Instances for special needs

In depth

Cluster operations: the hidden work

An ECS cluster is mostly a name that groups services; there is no control plane fee and no version to upgrade. With EKS, each cluster has a Kubernetes version. New minor versions arrive a few times a year, each has a standard support window, and clusters that stay on a version after standard support move into extended support, which costs much more per hour. Upgrading means testing your manifests against removed APIs, upgrading the control plane, then the nodes and the add-ons such as the VPC CNI, CoreDNS and kube-proxy.

On top of that come cluster-level tools: an ingress or the AWS Load Balancer Controller, a node autoscaler, metrics, logging and policy engines. Each is useful and each needs owners. EKS Auto Mode reduces this by having AWS manage nodes and several core components, but you still own the Kubernetes version and your workloads.

  • EKS: per-cluster hourly fee, higher in extended support
  • Plan regular version upgrades
  • Add-ons: VPC CNI, CoreDNS, kube-proxy, Pod Identity Agent
  • ECS: no control plane to upgrade

Compute options compared

Fargate is available to both. On ECS it is the default choice. On EKS, Fargate profiles run selected pods without nodes, but with limits such as no DaemonSets and no GPUs, so many EKS users prefer nodes.

For EC2 on ECS, you can use an Auto Scaling group capacity provider (you own the instances) or ECS Managed Instances, where AWS picks, patches and replaces the EC2 instances and still lets you choose instance attributes such as GPUs. For EKS, managed node groups create and update EC2 nodes for you, self-managed nodes give full control, Karpenter launches right-sized nodes for pending pods, and EKS Auto Mode hands node lifecycle to AWS. As a rule, the more of the stack AWS manages, the less you tune and the less you patch.

LayersWho manages what, from most to least AWS-managed
  1. 1
    Fargate (ECS or EKS)

    AWS runs the compute; you size each task or pod

  2. 2
    ECS Managed Instances or EKS Auto Mode

    AWS picks, patches and replaces EC2 for you

  3. 3
    EKS managed node groups

    AWS creates and updates nodes; you choose when

  4. 4
    Self-managed EC2 nodes or ASG capacity

    You own AMIs, patching and scaling

Workload identity: task roles and EKS Pod Identity

In ECS, the taskRoleArn in the task definition is the whole story. In EKS, pods use Kubernetes service accounts. With EKS Pod Identity you install the EKS Pod Identity Agent add-on, create an IAM role whose trust policy allows the service principal pods.eks.amazonaws.com, then create a pod identity association linking a namespace and service account to that role. Pods using that service account get temporary credentials for the role, and SDKs pick them up automatically.

The older method, IRSA (IAM roles for service accounts), uses the cluster's OIDC provider and an annotation on the service account. It still works and is needed in some cases, but Pod Identity is simpler to set up across many clusters because the role does not have to name each cluster's OIDC provider. Either way, avoid giving pods the node's instance role.

  • ECS: taskRoleArn
  • EKS: service account + pod identity association
  • Trust principal: pods.eks.amazonaws.com
  • IRSA: OIDC provider plus service account annotation

Scaling models

ECS service auto scaling uses Application Auto Scaling: target tracking on average CPU, memory or ALB requests per target, step scaling, or scheduled scaling. Capacity providers with managed scaling then add or remove EC2 instances to fit the tasks; on Fargate there is nothing more to scale.

Kubernetes splits the job in two. The Horizontal Pod Autoscaler changes the number of pods from metrics, and a node autoscaler such as Karpenter or Cluster Autoscaler adds nodes when pods cannot be scheduled. Event-driven scalers such as KEDA can scale on queue depth. This gives fine control, for example bin-packing many small pods onto Spot instances, but it is another system to tune and watch.

Learn it in 5 short steps

About 30m each. Track them with a timer in your plan.

  1. 1
    Compare cluster operations work~30m
  2. 2
    Compare Fargate, EC2 and managed nodes~30m
  3. 3
    Map task roles to EKS Pod Identity~30m
  4. 4
    Compare scaling models~30m
  5. 5
    Decide for a given team~30m

Key points

  • ECS has less to operate; EKS gives Kubernetes APIs, tooling and portability.
  • An EKS cluster needs version upgrades on a schedule, plus add-ons such as the VPC CNI and CoreDNS kept current.
  • Workload identity maps cleanly: ECS task role equals an EKS Pod Identity association on a service account.
  • Fargate removes node management on both, at a higher per-unit price than well-used EC2.
  • Choose EKS when the team already knows Kubernetes or needs its ecosystem, not to look modern.

Key terms

Tap a card to flip it. 0/6 known

Examples

Choosing for a four-person startup

The team runs the files API, a worker and an admin site, has no Kubernetes experience, and wants low operations work. Step 1: list needs: HTTP behind an ALB, queue-based scaling for the worker, per-service AWS permissions. Step 2: compare. ECS on Fargate covers all three with task roles, service auto scaling and ALB integration. EKS would add a cluster fee, upgrades and add-ons with no feature they need. Step 3: decide ECS on Fargate, and write down the trigger to revisit: if they adopt Kubernetes-only tools or hire a platform team.

Mapping an ECS task role to EKS Pod Identity

A platform team moves the worker to an existing EKS cluster. Step 1: install the Pod Identity Agent add-on. Step 2: create an IAM role with a trust policy for pods.eks.amazonaws.com (actions sts:AssumeRole and sts:TagSession) and attach the same permissions the ECS task role had. Step 3: create the association for namespace files and service account worker. Step 4: set serviceAccountName: worker in the deployment. Evidence: aws sts get-caller-identity run inside a pod shows the assumed role. Rollback: delete the association and the pod loses access.

bash
aws eks create-addon --cluster-name demo --addon-name eks-pod-identity-agent
aws eks create-pod-identity-association --cluster-name demo \
  --namespace files --service-account worker \
  --role-arn arn:aws:iam::111122223333:role/files-worker
kubectl -n files create serviceaccount worker
kubectl -n files exec deploy/worker -- aws sts get-caller-identity

Quick reference

  • ECS: no control plane fee or upgrades; EKS: hourly per-cluster fee plus version upgrades
  • EKS clusters past standard support pay the higher extended support rate
  • ECS task role = EKS Pod Identity association on a service account
  • Pod Identity trust principal: pods.eks.amazonaws.com
  • ECS scaling: Application Auto Scaling + capacity providers; EKS: HPA + Karpenter or Cluster Autoscaler
  • EKS Fargate profiles: no DaemonSets, no GPUs
  • Pick EKS for Kubernetes needs and skills, not by default

Common mistakes

  • Picking EKS for a three-service app with no Kubernetes skills, then falling behind on version upgrades.
  • Forgetting that EKS clusters on versions past standard support are billed at the higher extended support rate.
  • Giving pods the node's instance role instead of per-workload identity, so every pod shares one set of permissions.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Which job exists with EKS but not with ECS?

Question 2

2Which service principal must an IAM role trust for EKS Pod Identity?

Question 3

3In Kubernetes, what adds nodes when pods cannot be scheduled?

Question 4

4A team needs a Kubernetes operator from a vendor that only ships Helm charts. What does this suggest?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Map these ECS concepts to their EKS equivalents: task definition, service, task role, service auto scaling.

  2. Exercise 2medium

    Estimate the yearly control plane cost of three EKS clusters (dev, staging, prod) at a sample price of $0.10 per cluster-hour, and what happens if they fall into extended support at $0.60.

  3. Exercise 3hard

    Write a one-page decision record for a 30-engineer company with two platform engineers, 25 services and on-premises Kubernetes. Choose ECS or EKS and list risks.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Is EKS more expensive than ECS?
EKS adds a per-cluster control plane fee and usually more tooling. The compute itself (Fargate or EC2) costs the same on both, so the real difference is the fee plus the staff time to operate the cluster.
Can I move from ECS to EKS later?
Yes. The container images stay the same. You rewrite task definitions as Kubernetes manifests and map task roles to service accounts, so keeping images and configuration clean makes a later move easier.
What is EKS Auto Mode?
A way of running EKS where AWS manages the worker nodes and several core components, such as scaling, load balancing and storage drivers. You still choose the Kubernetes version and deploy your own workloads.

Go deeper

ShareXLinkedInWhatsApp