Thuta Learning
AWS Advanced
ContainersDevOpsAdvanced

EKS vs ECS — When Kubernetes Is Worth It

AWS AdvancedLesson 1445 min

What you'll walk away with

  • Separate what the EKS control plane covers from what you still own
  • Compare managed node groups, Fargate profiles, Karpenter and Auto Mode
  • Give pods IAM permissions with IRSA and EKS Pod Identity
  • Estimate the operational load of upgrades and add-ons
  • Choose ECS, EKS or Lambda for a workload and justify it

Explain it simply

Explain it simply

ECS is AWS's own container orchestrator; EKS (Elastic Kubernetes Service) is AWS's managed version of open-source Kubernetes. Both do the same basic job: decide where containers run, restart them when they die, and wire them to load balancers.

The difference is the ecosystem and how much you own. Kubernetes has thousands of Helm charts, operators and GitOps tools, and the same API works on other clouds. In exchange you handle version upgrades, add-ons and nodes far more yourself. ECS is like renting a fully furnished apartment; EKS is like a serviced plot of land where you build what you like — more freedom, and more to maintain.

Problem → Why → Solution

The problem — three services, and suddenly a platform team

A five-developer startup picked EKS for its three API services because it was 'the industry standard'. The cluster came up and the first deploy worked. Over the next six months they installed an ingress controller, a node autoscaler, DNS automation, certificate management and a metrics stack, one by one, and had to keep all their versions in step.

Then the Kubernetes version neared the end of standard support, the upgrade broke two Helm charts that used deprecated APIs, and roughly a third of the team's time was going into running the platform instead of building features. The list below is what they ended up owning.

what-we-now-own.txt
cluster: demo (EKS)          owner: "whoever has time"
  - managed node group AMI updates          every few weeks
  - Kubernetes minor version upgrade        ~every 4 months upstream
  - add-ons: vpc-cni, coredns, kube-proxy   per upgrade
  - AWS Load Balancer Controller (Helm)     separate release cycle
  - cluster autoscaler / Karpenter          separate release cycle
  - external-dns, cert-manager              separate release cycles
  - Prometheus + Grafana                    storage, retention, upgrades
  - RBAC + access entries for 5 people      ad hoc
services actually shipped to customers:     3

Why this happens

EKS manages the control plane only. Most of what makes a cluster production-ready — add-ons, controllers, upgrade planning — stays with you. ECS builds most of that into the service itself, which is a large difference in time cost for a small team.

Core concept — what EKS owns and what you own

Control plane
The brain of Kubernetes: the API server, the etcd database that stores all cluster state, the scheduler and the controllers. In EKS, AWS runs, patches and backs it up across multiple AZs.

When you create an EKS cluster, AWS runs the control plane in an AWS-owned account, not yours. It connects to your VPC through ENIs, and kubectl talks to the API server endpoint. You never worry about etcd corruption or scaling the API server — that is the core value of EKS.

The data plane — the compute where pods actually run — carries more or less responsibility depending on which option you pick. On top of that, add-ons such as networking (VPC CNI), DNS (CoreDNS) and kube-proxy, the load balancer controller, the autoscaler, RBAC and Kubernetes version upgrades stay in your hands.

text
EKS SHARED RESPONSIBILITY
-------------------------
+----------------- AWS-managed (AWS account) ------------------+
|  API server x N   etcd (multi-AZ)   scheduler   controllers |
+------------------------------+-------------------------------+
                               | ENIs in your VPC
+------------------------------v-------------------------------+
| YOUR account / VPC                                           |
|  add-ons: vpc-cni  coredns  kube-proxy  pod-identity-agent   |
|  controllers: LB controller, Karpenter, external-dns ...     |
|  +--------------+  +--------------+  +---------------------+  |
|  | managed node |  | Fargate      |  | Karpenter / Auto    |  |
|  | group (EC2)  |  | profile pods |  | Mode nodes (EC2)    |  |
|  +--------------+  +--------------+  +---------------------+  |
|  you: version upgrades, RBAC/access, IAM for pods, workloads |
+--------------------------------------------------------------+
Compute optionWhat you still handle
Managed node groupPick instance types, trigger AMI updates, add an autoscaler
Fargate profileOne microVM per pod; no DaemonSets, GPUs or privileged pods
KarpenterInstall and upgrade the open-source controller, write NodePool rules
EKS Auto ModeAWS runs node lifecycle and some core add-ons, for an extra management fee

Karpenter is a node autoscaler that watches pending pods and launches exactly the instance size they need. You don't pre-create a node group per shape; it mixes Spot and many instance families, and consolidates under-used nodes away, which can cut cost a lot. EKS Auto Mode builds on Karpenter and has AWS take over node provisioning, OS patching and some networking and storage capabilities — it targets people who want ECS-like low operations with the Kubernetes API. What Auto Mode includes is still evolving, so check the docs for the current scope.

Mental model
  1. AWS: control plane + etcd
  2. You: add-ons + controllers
  3. You: nodes (or Fargate/Auto)
  4. You: upgrades ~every 4 months
  5. You: IAM per pod, RBAC

Think of EKS as a managed Kubernetes API, not a managed platform — you still build the platform on top.

An eksctl ClusterConfig

cluster.yaml
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: demo
  region: us-east-1
  # version omitted on purpose: eksctl uses its current default
managedNodeGroups:
  - name: general
    instanceTypes: ["m7g.large", "m6g.large"]
    minSize: 2
    maxSize: 6
    desiredCapacity: 2
    privateNetworking: true
addons:
  - name: vpc-cni
  - name: coredns
  - name: kube-proxy
  - name: eks-pod-identity-agent
iam:
  podIdentityAssociations:
    - namespace: orders
      serviceAccountName: orders-sa
      permissionPolicyARNs:
        - arn:aws:iam::aws:policy/AmazonSQSReadOnlyAccess

eksctl turns this file into CloudFormation stacks that create the cluster, a managed node group with two Graviton instance types, the four core add-ons, and a pod identity association for the orders-sa service account in the orders namespace. Run it with 'eksctl create cluster -f cluster.yaml'; expect around 15-20 minutes.

Day-2 checks on an EKS cluster, plus pod identity

Building the cluster is day one. Owning the platform means running checks like these regularly: which version are we on, which add-on versions, and what is compatible before an upgrade. At the end we add a pod identity association so the orders service's pods can read from SQS.

day2-checks.sh
CLUSTER=demo
aws eks update-kubeconfig --name $CLUSTER --region us-east-1

K8S_VERSION=$(aws eks describe-cluster --name $CLUSTER \
  --query 'cluster.version' --output text)
echo "control plane: $K8S_VERSION"

aws eks list-nodegroups --cluster-name $CLUSTER
aws eks list-addons --cluster-name $CLUSTER

# newest vpc-cni build that supports our Kubernetes version
aws eks describe-addon-versions --kubernetes-version $K8S_VERSION \
  --addon-name vpc-cni \
  --query 'addons[0].addonVersions[0].addonVersion' --output text

ROLE_ARN=arn:aws:iam::111122223333:role/orders-sqs-reader
aws eks create-pod-identity-association --cluster-name $CLUSTER \
  --namespace orders --service-account orders-sa --role-arn $ROLE_ARN
aws eks list-pod-identity-associations --cluster-name $CLUSTER --namespace orders

kubectl get nodes -L node.kubernetes.io/instance-type

Code breakdown

  1. update-kubeconfigaws eks update-kubeconfig --name $CLUSTER

    Adds the cluster to ~/.kube/config so kubectl authenticates with your IAM identity. Whether that identity may do anything inside the cluster is decided by access entries (or, on older clusters, the aws-auth ConfigMap).

  2. describe-cluster--query 'cluster.version'

    Reads the control plane's Kubernetes minor version. Its end-of-standard-support date belongs on your team calendar.

  3. list-addons / describe-addon-versions--kubernetes-version $K8S_VERSION --addon-name vpc-cni

    Each add-on publishes which versions support which Kubernetes version. Add-ons must be brought in line before and after every control plane upgrade.

  4. create-pod-identity-association--namespace orders --service-account orders-sa --role-arn $ROLE_ARN

    Pods that use the orders-sa service account in the orders namespace now receive temporary credentials for this IAM role, without widening the node instance role for everyone.

  5. kubectl get nodes-L node.kubernetes.io/instance-type

    Shows each node's instance type as a column — with Karpenter you will see a mix of types here.

You should see
Sample output (versions and IDs will differ):
control plane: 1.33
{"nodegroups": ["general"]}
{"addons": ["coredns", "eks-pod-identity-agent", "kube-proxy", "vpc-cni"]}
v1.19.5-eksbuild.1
{"associations": [{"namespace": "orders", "serviceAccount": "orders-sa", ...}]}

IAM for pods — IRSA and EKS Pod Identity

If pods fall back to the node's instance role, every pod on that node shares the same permissions — the same problem as an ECS task without a task role. EKS has two ways to give each pod (each service account) its own role.

IRSA (IAM Roles for Service Accounts) registers each cluster's OIDC issuer as an IAM identity provider, and the role's trust policy names that cluster's OIDC URL and the service account. The service account gets an eks.amazonaws.com/role-arn annotation. The main pain is editing trust policies every time you add a cluster.

EKS Pod Identity is simpler. The role trusts pods.eks.amazonaws.com once, and the cluster/namespace/service-account binding lives in the EKS API as an association. No OIDC provider is needed and one role can be reused across many clusters. It needs the eks-pod-identity-agent add-on, and it is not available for Fargate pods, which still use IRSA.

pod-identity-role.sh
cat > pod-identity-trust.json <<'EOF'
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": { "Service": "pods.eks.amazonaws.com" },
      "Action": ["sts:AssumeRole", "sts:TagSession"]
    }
  ]
}
EOF
aws iam create-role --role-name orders-sqs-reader \
  --assume-role-policy-document file://pod-identity-trust.json
aws iam attach-role-policy --role-name orders-sqs-reader \
  --policy-arn arn:aws:iam::aws:policy/AmazonSQSReadOnlyAccess
aws eks create-addon --cluster-name demo --addon-name eks-pod-identity-agent
orders.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: orders-sa
  namespace: orders
  # IRSA only: with EKS Pod Identity this annotation is not needed
  # annotations:
  #   eks.amazonaws.com/role-arn: arn:aws:iam::111122223333:role/orders-sqs-reader
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: orders-worker
  namespace: orders
spec:
  replicas: 2
  selector:
    matchLabels: { app: orders-worker }
  template:
    metadata:
      labels: { app: orders-worker }
    spec:
      serviceAccountName: orders-sa
      containers:
        - name: worker
          image: 111122223333.dkr.ecr.us-east-1.amazonaws.com/orders-worker:2.1.0
          resources:
            requests: { cpu: 250m, memory: 256Mi }

Upgrade cadence and operational load

Upstream Kubernetes ships about three minor versions a year. In EKS each version gets 14 months of standard support followed by 12 months of extended support — but during extended support the cluster's hourly price is several times the standard rate. In practice you upgrade every cluster at least once a year, and usually about twice.

Upgrades go one minor version at a time and cannot be rolled back. The usual sequence is: check for deprecated APIs (EKS upgrade insights helps), upgrade the control plane, update the add-ons, then roll the nodes. In an organization with ten clusters this becomes a permanently running workstream. ECS has no equivalent version upgrade.

1. Check deprecated APIs

Use upgrade insights and scan manifests and Helm charts for API versions that the next release removes.

2. Upgrade the control plane

Move exactly one minor version. The API server rolls with no downtime, but there is no way back.

3. Update add-ons

Bring vpc-cni, coredns, kube-proxy and every self-installed controller to a compatible version.

4. Roll the nodes

Replace nodes with a managed node group update or Karpenter drift. Correct PodDisruptionBudgets matter here.

Cost drivers and a decision guide

EKS charges a flat hourly fee per cluster for the control plane (around $0.10 per hour in standard support in us-east-1, a little over $70 a month — check the pricing page). The ECS control plane is free. On the compute side, both pay the same EC2 or Fargate prices.

The real difference is everything you run yourself: the monitoring stack, node capacity for controllers, the per-cluster fee and, above all, engineer time. Splitting each environment (dev, staging, prod) into its own cluster multiplies those costs. On the other hand, for large teams with many workloads, Karpenter's bin-packing and heavy Spot use can make compute noticeably cheaper.

ChoicePick it when
LambdaEvent-driven, spiky load, each request under 15 minutes, pay nothing when idle
ECS (Fargate)Long-running containers, AWS-only, no or small platform team
EKSExisting Kubernetes skills and tooling, multi-cloud, need operators or Helm ecosystem, have a platform team
text
PLATFORM DECISION TREE
----------------------
            short, event-driven, spiky?
               |                    |
              yes                   no
               v                    v
            Lambda      already run Kubernetes, or need
                        its ecosystem / portability?
                           |                  |
                          yes                 no
                           v                  v
              have people to run it?        ECS on Fargate
                 |              |
                yes             no
                 v              v
          EKS (+Karpenter)   EKS Auto Mode, or reconsider ECS

In production

How teams run this in production

Organizations that run EKS well share a pattern: a dedicated platform team provides a 'golden path' for application teams. Application teams push a Helm chart or Kustomize overlay to Git, and a GitOps tool such as Argo CD or Flux syncs it into the cluster. They also keep the number of clusters as low as possible and separate teams with namespaces and RBAC.

Teams that choose ECS usually package their platform as a shared CDK construct library instead. In large organizations it is normal to run both: the data/ML platform on EKS because it needs Kubernetes operators, plain web services on ECS, and event glue on Lambda. What matters is making each choice with its operations cost in plain view.

Plan the network early

The Amazon VPC CNI gives every pod a real VPC IP, so small subnets such as a /24 run out fast. Plan large subnets (or a secondary CIDR) and prefix delegation before you build the cluster.

Common mistakes

Common mistakes

Mistake 1 — granting everything to the node instance role

When a pod needs to read S3, the quick fix is adding s3:* to the node instance role. But every pod that lands on that node — third-party Helm charts included — now has that permission. Use Pod Identity or IRSA to give each service account its own role, and limit pod access to instance metadata (IMDSv2 with a hop limit of 1).

Mistake 2 — thinking about upgrades only once extended support hits

Leave upgrades for 'when we have time' and the cluster drifts into extended support, where the control plane costs several times more. You also fall two or three versions behind, so each upgrade means facing many deprecated APIs and every add-on at once. Schedule upgrades as recurring quarterly work.

Mistake 3 — choosing EKS for the résumé

A team with a handful of services and no platform engineer that picks Kubernetes loses feature time, exactly as in the problem section. Write down which Kubernetes-ecosystem features you actually need — if the list is empty, ECS or Lambda fits better.

Best practices

Best practices

  • Keep the number of clusters low; separate teams with namespaces, RBAC and ResourceQuotas.
  • Prefer EKS managed add-ons where possible — AWS checks their version compatibility.
  • Use access entries instead of the aws-auth ConfigMap on new clusters.
  • Keep all cluster configuration as code (eksctl, CDK or Terraform) and rehearse upgrades on a staging cluster first.

💰 Cost & Cleanup

EKS has no free tier. The control plane fee (about $0.10 per hour in standard support) starts the moment the cluster exists, and the managed node group's EC2 instances, the NAT Gateway and EBS volumes also bill hourly. eksctl creates several CloudFormation stacks, so delete with the command below instead of clicking through the console, and do it as soon as the lab is done. Check the pricing page for exact rates.

Clean up when you are done

cleanup.sh
ASSOC_ID=$(aws eks list-pod-identity-associations --cluster-name demo \
  --namespace orders --query 'associations[0].associationId' --output text)
aws eks delete-pod-identity-association --cluster-name demo --association-id $ASSOC_ID
eksctl delete cluster --name demo --region us-east-1 --wait
aws iam detach-role-policy --role-name orders-sqs-reader \
  --policy-arn arn:aws:iam::aws:policy/AmazonSQSReadOnlyAccess
aws iam delete-role --role-name orders-sqs-reader

Mini challenge

Mini challenge — a platform decision record

A company has three workloads: (A) an image-thumbnail job triggered by about 200 uploads a day; (B) four REST APIs that run 24/7 (six developers, no platform engineer); (C) a data platform that needs Kubernetes operators such as Spark and Kafka operators (three platform engineers). Choose a platform for each and justify it.

  • Pick Lambda, ECS or EKS for each workload
  • Consider both operations cost and compute cost
  • Add one line per workload on what change would make you revisit the choice

Expected: Something like A = Lambda, B = ECS on Fargate, C = EKS, each with an operations and cost justification.

Show hint

Walk the decision tree from the top. 'Does this team have people to run Kubernetes?' is the question that matters most.

Show solution
platform-decision.md
A thumbnails  -> Lambda (S3 event trigger)
  why: ~200 short jobs/day; idle the rest of the time; no servers or
       cluster fee; per-invocation pricing is close to zero at this volume
  revisit if: jobs exceed 15 minutes or need a GPU -> ECS/Batch task

B REST APIs   -> ECS on Fargate behind one ALB
  why: always-on containers; no platform engineer to own upgrades,
       add-ons or node patching; free control plane; CDK construct
       library shared across the 4 services
  revisit if: the org adopts Kubernetes elsewhere and gains a platform team

C data platf. -> EKS (managed node groups or Karpenter, Spot for executors)
  why: Spark/Kafka operators exist only for Kubernetes; 3 platform
       engineers can own upgrades; Karpenter bin-packing + Spot cuts
       compute cost for bursty Spark jobs
  revisit if: a managed service (EMR Serverless, MSK) covers the need

Quick quiz 1 / 3

In an EKS cluster, which part does AWS fully manage?

Quick quiz 2 / 3

You want one IAM role used by pods across 12 clusters without editing its trust policy every time a cluster is added. What should you use?

Quick quiz 3 / 3

What can you NOT run on an EKS Fargate profile?

What to remember

  • EKS = a managed control plane; add-ons, controllers, upgrades and workload IAM are yours.
  • Compute options — managed node groups, Fargate profiles, Karpenter, Auto Mode — differ in operational load.
  • For pod IAM, use EKS Pod Identity (simple, reusable across clusters) or IRSA (needed for Fargate pods).
  • Each version gets 14 months of standard support — plan upgrades as routine work.
  • Choose Lambda, ECS or EKS by workload shape and your team's operations capacity.

Amazon EKS User Guide — AWS Documentation

EKS Pod Identity — AWS Documentation

Amazon EKS Best Practices Guide — AWS Documentation

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

EKS vs ECS — When Kubernetes Is Worth It | Thuta Learning