Ravindra BagaleCourses & study guides Track your progress

AWS Cloud

AWS Container Interview Questions and Answers: ECS, EKS, Fargate and ECR (50 Questions)

This page has 50 new interview questions on running containers in AWS with ECR, ECS, Fargate and EKS, with full answers. Containers are now the default way to run many applications, so these questions appear in DevOps, SRE, platform and backend interviews.

1. An everyday example: shipping containers at a port

Containers make apps easy to move and run the same way everywhere. But running hundreds of containers safely needs scheduling, networking, permissions and scaling. Interviewers test whether you understand these parts on AWS.

Think of a shipping port. A container image is a sealed shipping container packed the same way every time. ECR is the warehouse where containers are stored. ECS and EKS are the port managers who decide which ship (server) carries which container. Fargate is a shipping company that brings its own ships, so you only hand over containers. The task definition or pod spec is the label that says size, weight and handling rules.

How to use this page

  • Know the difference between ECS terms (task, service) and Kubernetes terms (pod, deployment).
  • For every troubleshooting question, say where you look: events, logs, and the IAM roles.
  • Practise with small Fargate tasks and stop them after the lab.

2. Fresher level questions

Start here if you are a fresher or have less than two years of experience. Try to answer each question aloud first. Then open it and compare.

Q1. What is Amazon ECR? Fresher

Amazon ECR (Elastic Container Registry) is a managed registry to store, share and deploy container images.

It supports private repositories with IAM access control, and public repositories in the ECR Public Gallery.

Features include image scanning for vulnerabilities, lifecycle policies to delete old images, immutable tags, encryption, and replication to other Regions or accounts.

ECS, EKS, Lambda and App Runner can pull images directly from ECR.

Q2. How do you push a Docker image to ECR? Fresher

Four steps: log in, build, tag, push.

aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 111122223333.dkr.ecr.ap-south-1.amazonaws.com
docker build -t shop-api:1.4.0 .
docker tag shop-api:1.4.0 111122223333.dkr.ecr.ap-south-1.amazonaws.com/shop-api:1.4.0
docker push 111122223333.dkr.ecr.ap-south-1.amazonaws.com/shop-api:1.4.0

Output:

Login Succeeded
1.4.0: digest: sha256:4f2a...9c1e size: 1784

The login token is valid for 12 hours. The digest is the unique ID of the pushed image. Using a version tag, not only latest, makes deployments traceable.

Q3. What is Amazon ECS? Fresher

Amazon ECS (Elastic Container Service) is AWS's own container orchestration service.

You describe your containers in a task definition. ECS places and runs those tasks on EC2 instances you manage or on Fargate, and keeps services running at the desired count.

It integrates with load balancers, IAM, CloudWatch, Service Connect and auto scaling.

There is no extra charge for ECS itself. You pay for the compute (EC2 or Fargate) and other resources you use.

Q4. What goes inside an ECS task definition, and why do revisions matter for rollback? Fresher

A task definition is a JSON blueprint for one or more containers that run together.

It includes the image, CPU and memory, port mappings, environment variables, secrets, logging settings, the IAM task role, the execution role and the network mode.

Each change creates a new revision, such as shop-api:7. Services point to a specific revision, so you can roll back to an older revision easily.

Q5. When do you run a standalone ECS task, and when do you need an ECS service? Fresher

A task is one running copy of a task definition. It can be a short job that runs and stops.

A service keeps a desired number of tasks running all the time. If a task stops or fails a health check, the service starts a new one.

Services also register tasks with load balancers, handle rolling deployments and scale with auto scaling.

Use tasks for batch jobs, and services for long-running apps like APIs and websites.

Q6. What is AWS Fargate? Fresher

Fargate is a serverless compute engine for containers. It works with ECS and EKS.

You do not create, patch or scale EC2 instances. You only choose vCPU and memory for each task or pod, and AWS runs it in an isolated environment.

You pay for the vCPU, memory and extra storage your tasks use, per second, with a one-minute minimum.

Fargate Spot gives a discount for interruptible ECS tasks.

Q7. Which ECS role does your application code use, and which one pulls images and writes logs? Fresher

The task execution role is used by the ECS agent to set up the task: pull the image from ECR, send logs to CloudWatch Logs, and fetch secrets from Secrets Manager or Parameter Store.

The task role is used by your application code inside the container, for example to read from S3 or write to DynamoDB.

Mixing them up is a common mistake. Image pull errors usually mean an execution role problem, while AccessDenied from the app usually means a task role problem.

Q8. What is Amazon EKS? Fresher

Amazon EKS (Elastic Kubernetes Service) is a managed Kubernetes service.

AWS runs and scales the Kubernetes control plane (API server and etcd) across multiple Availability Zones, and patches it.

You run worker capacity using managed node groups, self-managed nodes, Karpenter, Fargate, or EKS Auto Mode, depending on how much you want AWS to manage.

Use EKS when your team needs Kubernetes APIs, tools and portability.

Q9. What is a container image tag and why should you avoid using only "latest"? Fresher

A tag is a label for an image version, such as shop-api:1.4.0.

The tag latest just means "the last image pushed without a tag". It moves over time.

If you deploy latest, you cannot easily know which code is running, and a new node may pull a different image than older nodes.

Best practice: use unique tags, such as a version or Git commit ID, and turn on tag immutability in ECR so a tag cannot be overwritten.

Q10. What does the awsvpc network mode mean in ECS? Fresher

In awsvpc mode, each task gets its own elastic network interface with a private IP from your VPC subnet.

So each task can have its own security group, and it looks like a normal VPC host on the network.

Fargate tasks always use awsvpc mode. It makes network security simpler, but uses one IP per task, so plan subnet sizes for the number of tasks.

Q11. How would you explain to a manager why a team might pick ECS instead of EKS, or the other way round? Fresher

ECS is AWS's own, simpler orchestrator. It is deeply integrated with AWS and has no control plane charge. It is good for teams that want to run containers on AWS with less to learn.

EKS runs standard Kubernetes. It has a per-cluster hourly charge and more moving parts, but it gives the Kubernetes ecosystem: Helm, operators, and portability to other clouds and on-premises.

Choose based on team skills and needs, not fashion.

Q12. What is a Kubernetes pod? Fresher

A pod is the smallest unit you deploy in Kubernetes. It has one or more containers that share the same network IP and can share storage volumes.

Usually a pod has one main app container, sometimes with a helper sidecar, such as a log forwarder.

Pods are temporary. If a pod dies, a controller such as a Deployment creates a new one with a new IP. So apps talk to pods through a Service, not by pod IP.

Q13. How do container logs reach CloudWatch in ECS? Fresher

Use the awslogs log driver in the task definition. Set the log group, Region and stream prefix.

The container writes to stdout and stderr, and ECS sends those lines to CloudWatch Logs.

The task execution role needs permission to create log streams and put log events.

For more routing options, such as sending to OpenSearch or S3, use FireLens with Fluent Bit as a sidecar.

Q14. How do you list running ECS services and their counts with the CLI? Fresher

Use describe-services with a query.

aws ecs describe-services --cluster shop-prod --services shop-api shop-web --query "services[].{name:serviceName,desired:desiredCount,running:runningCount,pending:pendingCount}" --output table

Output:

----------------------------------------------
|              DescribeServices              |
+----------+-----------+-----------+---------+
| desired  |   name    |  pending  | running |
+----------+-----------+-----------+---------+
|  4       |  shop-api |  0        |  4      |
|  2       |  shop-web |  1        |  1      |
+----------+-----------+-----------+---------+

shop-api is healthy. shop-web has one task stuck in pending, so check the service events for the reason.

Q15. What is an ECS capacity provider? Fresher

A capacity provider tells ECS where to run tasks and how to manage that capacity.

Types: FARGATE, FARGATE_SPOT, and Auto Scaling group capacity providers for EC2.

A capacity provider strategy splits tasks, for example base 2 on FARGATE and the rest weighted 1 to FARGATE and 3 to FARGATE_SPOT.

For EC2, managed scaling grows and shrinks the Auto Scaling group based on the tasks that need to run.

Q16. How does an ECS service work with an Application Load Balancer? Fresher

You link the service to an ALB target group.

When a task starts, ECS registers its IP and port in the target group. When the task stops, ECS deregisters it.

The ALB health checks decide whether each task gets traffic. If a task fails health checks, the service replaces it.

With awsvpc mode, the target type is "ip". The task's security group must allow traffic from the ALB's security group on the container port.

Q17. What is a Kubernetes Deployment and a Service? Fresher

A Deployment manages a set of identical pods. It keeps the desired replica count and does rolling updates when you change the image.

A Service gives a stable name and IP for a group of pods, selected by labels, and spreads traffic across them.

Types include ClusterIP (internal), NodePort, and LoadBalancer. On EKS, a LoadBalancer Service or an Ingress with the AWS Load Balancer Controller creates an NLB or ALB.

3. Mid level questions

These questions check how you use the service in real projects. Interviewers expect the why, the how and one real example.

Q18. How do you give AWS permissions to pods in EKS? Mid level

Do not use the node's IAM role for all pods, because every pod on the node would get the same permissions.

Two options:

  • IAM Roles for Service Accounts (IRSA): uses the cluster's OIDC provider. You annotate a Kubernetes service account with a role ARN, and the role trust policy trusts that service account.
  • EKS Pod Identity: install the Pod Identity Agent add-on and create an association between a service account and an IAM role. It is simpler and does not need an OIDC provider per cluster.

Both give pods temporary credentials for least privilege.

Q19. How does pod networking work with the Amazon VPC CNI? Mid level

The Amazon VPC CNI plugin gives each pod a real IP address from your VPC subnet.

Pods can talk directly to other VPC resources, and security tools see real VPC IPs.

The downside is IP usage. Each node can hold a limited number of pod IPs based on its ENIs. Large clusters can run out of subnet IPs.

Fixes: use prefix delegation to assign /28 prefixes to ENIs, use larger subnets, add secondary CIDR ranges with custom networking, or use IPv6 clusters.

Q20. What is the difference between managed node groups, Karpenter, Fargate and EKS Auto Mode? Mid level

Managed node groups: AWS creates and updates EC2 nodes in an Auto Scaling group for you. You still choose instance types and trigger upgrades.

Karpenter: an open-source autoscaler that launches the right-sized EC2 instance for pending pods quickly, and removes empty or underused nodes.

Fargate on EKS: each pod runs on its own Fargate capacity. No nodes to manage, but some features like DaemonSets are not supported.

EKS Auto Mode: AWS manages compute, networking and storage components of the data plane for you, using Karpenter-based provisioning.

Q21. How do you scale an ECS service automatically? Mid level

Use Service Auto Scaling, which uses Application Auto Scaling.

  • Target tracking: keep average CPU at 60 percent, or ALB requests per target at 500.
  • Step scaling: add tasks in steps based on CloudWatch alarms.
  • Scheduled scaling: raise the minimum before known peaks.

Set minimum and maximum task counts. On EC2, also use a capacity provider with managed scaling, so instances are added when tasks cannot be placed.

Q22. What deployment options does ECS support? Mid level
  • Rolling update: ECS replaces old tasks with new ones, controlled by minimumHealthyPercent and maximumPercent.
  • Blue/green: run the new version next to the old one, test it, then shift traffic, with quick rollback. ECS supports blue/green deployments natively, and you can also use CodeDeploy.
  • External: a third-party controller manages deployments.

Turn on the deployment circuit breaker with rollback, so a deployment that keeps failing goes back to the last working version automatically.

Q23. How do you pass secrets to ECS tasks? Mid level

Use the secrets section of the container definition.

Point each environment variable to a Secrets Manager secret ARN or a Parameter Store parameter ARN. ECS fetches the value when the task starts and injects it as an environment variable.

The task execution role needs permission to read those secrets and to decrypt with the KMS key.

Note: the value is read at start. If the secret rotates, restart tasks or have the app read the secret directly.

Q24. What is ECS Exec? Mid level

ECS Exec lets you open a shell or run a command inside a running container, for both Fargate and EC2, without SSH.

aws ecs execute-command --cluster shop-prod --task 0a1b2c3d4e5f60718293a4b5c6d7e8f9 --container shop-api --interactive --command "/bin/sh"

It uses Systems Manager under the hood. You must enable execute command on the service or task, and the task role needs SSM messages permissions. Sessions can be logged to CloudWatch or S3 for audit.

Q25. How do ECS services find and talk to each other? Mid level

Options:

  • Service Connect: ECS adds a proxy to each task and gives services short names, such as http://orders:8080, with built-in retries and metrics. It is the recommended option for ECS-to-ECS traffic.
  • Service discovery with AWS Cloud Map: tasks are registered as DNS records.
  • Internal load balancers: put an internal ALB in front of each service.

Choose based on traffic volume, need for metrics, and cost.

Q26. How do you upgrade an EKS cluster? Mid level

Upgrade one minor version at a time, for example 1.31 to 1.32.

  • Read the Kubernetes and EKS release notes for removed APIs, and check manifests and Helm charts.
  • Upgrade the control plane.
  • Upgrade add-ons: VPC CNI, CoreDNS, kube-proxy, EBS CSI driver and others to compatible versions.
  • Upgrade node groups or let Karpenter replace nodes with the new AMI.
  • Use PodDisruptionBudgets so apps stay available during node replacement.

Test in a staging cluster first. Each EKS version has standard support and then paid extended support, so plan upgrades early.

Q27. How do you expose an EKS application to the internet? Mid level

Install the AWS Load Balancer Controller in the cluster.

  • For HTTP apps, create an Ingress resource. The controller creates an ALB with rules for paths and hosts.
  • For TCP or UDP apps, create a Service of type LoadBalancer. The controller creates an NLB.

Use target type "ip" so traffic goes straight to pod IPs. Add an ACM certificate annotation for HTTPS and AWS WAF for protection.

Q28. What is Fargate ephemeral storage and what are its limits? Mid level

Each Fargate task gets ephemeral storage for container layers and temporary files. By default it is 20 GiB, and on ECS you can increase it up to 200 GiB in the task definition.

The data is deleted when the task stops.

For data that must last, use EFS volumes, which Fargate supports, or store data in S3 or a database.

Q29. What are ECR lifecycle policies and image scanning? Mid level

Lifecycle policies delete old images automatically. Example: keep only the last 30 images tagged release-*, and delete untagged images after 7 days. This saves storage cost.

Image scanning finds known vulnerabilities:

  • Basic scanning checks images on push or manually.
  • Enhanced scanning uses Amazon Inspector for continuous scanning of OS and programming language packages.

Send findings to EventBridge and block deployments with critical findings in the pipeline.

Q30. What are Kubernetes requests and limits, and why do they matter on EKS? Mid level

Requests are what a container is guaranteed. The scheduler uses them to place pods on nodes.

Limits are the maximum. If memory goes over the limit, the container is killed (OOMKilled). If CPU goes over, it is throttled.

On EKS, correct requests help Karpenter or the cluster autoscaler choose the right node sizes and avoid waste.

Set them based on real usage from metrics, not guesses.

Q31. How does access control work for humans in an EKS cluster? Mid level

Two layers must allow access.

  • AWS side: the person's IAM role must be mapped into the cluster. The current recommended way is EKS access entries with access policies. The older way is the aws-auth ConfigMap.
  • Kubernetes side: RBAC Roles and RoleBindings decide what they can do in which namespaces.

Example: developers get edit access in the dev namespace and view access in prod.

Keep cluster admin access to a small group, and log API activity with EKS control plane audit logs.

Q46. What is the difference between the Horizontal Pod Autoscaler and node autoscaling on EKS? Mid level

The Horizontal Pod Autoscaler (HPA) changes the number of pod replicas based on metrics such as CPU, memory or custom metrics. It needs the Metrics Server or another metrics source.

Node autoscaling adds or removes EC2 nodes. Karpenter or the Cluster Autoscaler watches for pods that cannot be scheduled because there is no room, and adds nodes. It removes nodes that are empty or underused.

They work together: HPA creates more pods, and node autoscaling makes room for them.

Q47. What are ECS task placement strategies? Mid level

They apply to tasks on the EC2 launch type, not Fargate.

  • binpack: place tasks on as few instances as possible, based on CPU or memory. Saves cost.
  • spread: spread tasks evenly across a field, such as Availability Zone or instance ID. Improves availability.
  • random: place tasks randomly.

You can combine them, for example spread across AZs first, then binpack on memory. Placement constraints can also limit tasks to certain instance types.

Q48. How do pods on EKS get persistent storage? Mid level

Use a CSI driver as an add-on.

  • Amazon EBS CSI driver: creates EBS volumes for PersistentVolumeClaims. One volume attaches to one node in one AZ, good for databases running in a single pod.
  • Amazon EFS CSI driver: shared storage that many pods in many AZs can mount at the same time.
  • Mountpoint for Amazon S3 CSI driver: mount an S3 bucket for read-heavy workloads.

Define a StorageClass, then pods ask for storage with a PersistentVolumeClaim. The CSI driver needs IAM permissions through IRSA or Pod Identity.

Q49. How do you restrict network traffic between pods in EKS? Mid level

By default, all pods in a cluster can talk to each other.

Use Kubernetes NetworkPolicies to allow only needed traffic, for example only the frontend pods can call the orders pods on port 8080. The Amazon VPC CNI supports network policies when you turn that feature on. Other options include tools such as Calico or Cilium.

For traffic to AWS resources, you can also use security groups for pods, which apply VPC security groups to specific pods.

Start with a default deny policy per namespace and add allow rules.

4. Senior level and scenario questions

These questions check design thinking and troubleshooting. Think aloud. Say what you check first, what you change, and how you prevent it next time.

Q32. An ECS task fails to start with "CannotPullContainerError". How do you troubleshoot? Senior

The task could not download the image. Check:

  • Does the image and tag exist in ECR? A typo in the tag is common.
  • Does the task execution role have ECR pull permissions?
  • Network path: a task in a private subnet needs a NAT gateway, or VPC endpoints for ECR API, ECR Docker and S3 (gateway), to pull images.
  • If the task has a public IP setting off in a public subnet, it cannot reach ECR.
  • For cross-account images, the repository policy must allow the other account.

Check the stopped task's "stopped reason" in the console or with describe-tasks.

Q33. An ECS service keeps starting and stopping tasks. How do you find the cause? Senior

Read the service events and the stopped task reasons.

  • "Task failed ELB health checks": wrong health check path or port, app starting too slowly, or security group blocking the ALB. Add a health check grace period.
  • "Essential container exited": the app crashed. Read its CloudWatch logs for the error.
  • "OutOfMemoryError": raise task memory or fix a leak.
  • ResourceInitializationError: often secrets or log setup failed because of permissions or no network route.

The deployment circuit breaker can roll back automatically while you fix it.

Q34. A pod in EKS is in CrashLoopBackOff. How do you debug it? Senior

CrashLoopBackOff means the container starts, crashes and Kubernetes keeps restarting it with longer waits.

kubectl describe pod orders-7d9f8c6b5-x2k4q -n shop
kubectl logs orders-7d9f8c6b5-x2k4q -n shop --previous

Output:

Error: connect ECONNREFUSED 10.0.12.45:5432

The app crashed because it could not connect to the database. Check the database address, security groups, and whether the database is up. Other common causes: missing config or secret, wrong command, failing liveness probe, or OOMKilled (seen in describe output).

Q35. Pods in EKS cannot get IP addresses and stay Pending. What happened? Senior

The VPC subnets or the node ENIs ran out of IPs.

Checks:

  • kubectl describe pod shows events like "failed to assign an IP address to container".
  • Check free IPs in the node subnets.
  • Check the max pods value for the instance type.

Fixes:

  • Turn on prefix delegation in the VPC CNI to get many more IPs per ENI.
  • Add a secondary CIDR, such as from 100.64.0.0/10, and use custom networking for pods.
  • Use bigger subnets for new node groups, or IPv6.

Plan IPs before building big clusters.

Q36. How would you design a multi-tenant SaaS on EKS? Senior

Choose an isolation level per tenant tier.

  • Shared cluster with a namespace per tenant: use RBAC, network policies, resource quotas and LimitRanges. Cheapest.
  • Dedicated node groups for premium tenants, using taints and tolerations.
  • Separate clusters or accounts for tenants with strict compliance needs.

Give each tenant's pods their own IAM role with Pod Identity and use tenant tags on data. Track cost per tenant with split cost allocation data. Explain the trade-off between isolation and cost.

Q37. How do you handle Fargate Spot interruptions safely? Senior

Fargate Spot can stop tasks with a two-minute warning. ECS sends SIGTERM to the containers.

  • Make the app handle SIGTERM: stop taking new work, finish or checkpoint current work, and exit cleanly.
  • Set stopTimeout in the task definition so the app gets enough time, up to 120 seconds on Fargate.
  • Use a capacity provider strategy with a base on FARGATE and the rest on FARGATE_SPOT.
  • For queue workers, use SQS so unfinished messages become visible again.

Use Spot for stateless and fault-tolerant work only.

Q38. Your EKS cluster's costs are high. How do you reduce them? Senior

Look at node use first, because nodes are most of the cost.

  • Right-size requests using real metrics. Many teams over-request CPU and memory.
  • Use Karpenter for bin-packing and consolidation of underused nodes.
  • Use Spot instances for stateless workloads, and Graviton instances.
  • Scale down dev clusters at night.
  • Remove idle load balancers, old EBS volumes, and unused node groups.
  • Track cost per namespace with split cost allocation data for EKS.

Also review whether small workloads would be cheaper on ECS Fargate.

Q39. How do you do zero-downtime deployments on EKS? Senior

Combine several settings.

  • RollingUpdate strategy with maxUnavailable 0 and maxSurge 1 or more.
  • Readiness probes so traffic goes only to ready pods.
  • A preStop hook with a short sleep, and graceful shutdown on SIGTERM, so the load balancer deregisters the pod before it exits.
  • PodDisruptionBudgets for node drains.
  • Enough replicas spread across AZs with topology spread constraints.

For extra safety, use canary or blue/green with tools like Argo Rollouts and automatic rollback on bad metrics.

Q40. How do you secure container images from build to run? Senior

Cover the full supply chain.

  • Use small, trusted base images and update them often.
  • Scan images in the pipeline and in ECR with enhanced scanning. Fail builds on critical findings.
  • Use immutable tags and deploy by digest.
  • Sign images and verify signatures at deploy time with an admission controller.
  • Run containers as non-root with a read-only root filesystem where possible.
  • Give each task or pod least-privilege IAM.
  • Use runtime threat detection, such as GuardDuty Runtime Monitoring for EKS and ECS.
Q41. An app in ECS gets AccessDenied when writing to S3, but the task execution role has S3 permissions. Why? Senior

The execution role is used by the ECS agent, not by your code.

The application uses the task role. If no task role is set, or it lacks s3:PutObject, the app gets AccessDenied.

Fix: create a task role with the needed S3 permissions (and KMS permissions if the bucket uses SSE-KMS) and add its ARN as taskRoleArn in the task definition. Deploy a new revision.

Also check the bucket policy and any VPC endpoint policy.

Q42. How would you migrate a Docker Compose application from one EC2 server to ECS on Fargate? Senior

Step by step:

  • Push each service image to ECR with version tags.
  • Turn each Compose service into an ECS task definition: image, ports, environment, CPU and memory.
  • Move state out: database to RDS, files to S3 or EFS, sessions to ElastiCache.
  • Move secrets to Secrets Manager.
  • Create ECS services behind an ALB, and use Service Connect for internal calls.
  • Add auto scaling, logs and alarms.
  • Test in staging, then switch DNS with a low TTL, and keep the old server for rollback for a few days.
Q43. How do you run scheduled batch jobs with containers on AWS? Senior

Options:

  • EventBridge Scheduler or EventBridge rules starting ECS tasks on Fargate. Simple and serverless.
  • AWS Batch for large job queues, retries, dependencies and Spot capacity.
  • Kubernetes CronJobs on EKS.
  • Step Functions to run several container steps in order with retries.

Make each job idempotent, set timeouts, send logs to CloudWatch, and alarm when a job fails or does not run.

Q44. How do you design an EKS cluster for high availability? Senior

Cover both control plane and data plane.

  • The EKS control plane is already managed across multiple AZs by AWS.
  • Run worker nodes in at least three AZs.
  • Use topology spread constraints and anti-affinity so replicas of one app are in different AZs.
  • Run at least two or three replicas of each important app, with PodDisruptionBudgets.
  • Use EBS volumes carefully, because they are tied to one AZ. For shared data across AZs, use EFS or a managed database.
  • Back up cluster configuration with GitOps, and test node and AZ failures.
Q45. How do you troubleshoot slow image pulls that delay scaling? Senior

Large images take time to download and unpack on new nodes or tasks.

  • Make images smaller with multi-stage builds and slim base images.
  • Keep the same base layers across services so nodes reuse cached layers.
  • Use VPC endpoints for ECR to avoid NAT bottlenecks and costs.
  • Use ECR pull through cache for public images.
  • For very large images, consider lazy loading with Seekable OCI (SOCI) on Fargate.
  • Pre-pull images on new nodes in EKS with a DaemonSet or a baked AMI.

Measure pull time in task or pod events before and after.

Q50. How do you choose between Lambda, ECS on Fargate and EKS for a new microservice? Senior

Ask a few questions.

  • How long does each request or job run? On-demand Lambda Event Functions have a 30-minute limit. Check the execution mode, integration and retry behavior before ruling the workload in or out.
  • Is traffic spiky or steady? Spiky and low traffic suits Lambda. Steady traffic often costs less on containers.
  • Does the team know Kubernetes, and do you already run EKS? If not, ECS with Fargate is simpler.
  • Do you need special runtimes, long connections like WebSockets at scale, or GPUs? Containers fit better.
  • How much control and portability do you need? EKS gives the most.

A good answer picks one, explains why, and says what would make you change.

5. Frequently asked questions

Should I learn ECS or EKS first?

Learn ECS with Fargate first. It is simpler and teaches tasks, services, IAM roles and load balancers. Then learn Kubernetes basics and EKS.

Do interviewers expect Docker knowledge for AWS container roles?

Yes. Know how to write a Dockerfile, build, tag and push an image, and read container logs.

Which container topic is asked most to experienced candidates?

IAM for tasks and pods, networking and IP planning on EKS, autoscaling, and debugging failed deployments.

6. Quick revision

  • ECS task execution role pulls images and writes logs. The task role is for your app code.
  • Fargate removes server management. You pay for vCPU and memory per second.
  • EKS runs the Kubernetes control plane for you. You still manage add-ons, upgrades and workloads.
  • Use IRSA or EKS Pod Identity to give pods AWS permissions.
  • Use immutable image tags and image scanning in ECR.

This page is one part of a 500-question AWS interview set. Open the full list here: All 500 AWS interview questions.