Lesson 1 of 6 Container Platforms and Microservices

Understanding Container Orchestration with ECS, EKS and Fargate

This lesson explains the core concepts of container orchestration on AWS, how to choose between ECS and EKS and between Fargate and EC2 capacity, and how microservices are structured on them.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe images, orchestrators, task definitions, services, Deployments and pods.
  • Choose between ECS and EKS and between Fargate and EC2 capacity for a workload.
  • Explain how microservices are given independent permissions, scaling and pipelines.

Core concepts

A container image holds the application and its libraries and is stored in a registry such as Amazon ECR. An orchestrator runs images on a cluster of compute capacity, replaces failed containers, rolls out new versions and integrates with networking, IAM and logging. On AWS the orchestrators are Amazon ECS, an AWS-native service with its own API, and Amazon EKS, which runs upstream Kubernetes with an AWS-managed control plane. Capacity comes from EC2 instances that the customer manages, from AWS Fargate, which runs each task or pod in its own isolated environment with no instances to manage, or, for EKS, from EKS Auto Mode, which manages nodes and core add-ons.

In ECS, a task definition describes containers, CPU, memory, ports and the task role (IAM permissions for the application); a service keeps a desired count of tasks running behind a load balancer and performs deployments. In EKS, a Deployment keeps pods running, a Service exposes them, and pods get IAM permissions through EKS Pod Identity or IAM roles for service accounts.

Choosing ECS or EKS, Fargate or EC2

The choice depends on the team and the workload more than on features. ECS is simpler to operate and tightly integrated with AWS; EKS suits teams with Kubernetes skills and manifests, Helm charts and open-source tooling, or a need for the same platform on premises and in other clouds. Fargate removes node management and suits most services; EC2 capacity is needed for GPUs, specific instance types, very high density or daemon-style agents, and can be cheaper at steady high utilisation with commitments.

ECS
API and toolingAWS-native API, task definitions
Operational effortLow
PortabilityAWS (and ECS Anywhere)
Choose when AWS-focused teams that want the simplest managed orchestration.
EKS
API and toolingKubernetes API, manifests, Helm, operators
Operational effortHigher (cluster versions, add-ons), reduced by Auto Mode
PortabilityAny Kubernetes environment, EKS Anywhere, Hybrid Nodes
Choose when Teams with Kubernetes skills, tooling or multi-environment needs.
Scenario questions

Choosing a container platform

Exam skills 1.1.6

Choose the orchestration and capacity options for each team.

Log in to try this activity Interactive activities are free with an account.

Structuring microservices

  • Each microservice is its own ECS service or Kubernetes Deployment, with its own image, task role or pod identity, scaling policy and pipeline, so teams release independently.
  • Services own their data stores and communicate through APIs or events, not shared databases.
  • Capacity providers (ECS) or Karpenter and Auto Mode (EKS) mix On-Demand, Spot and Graviton capacity without per-service node management.
  • Clusters are usually shared by several services of a team or domain, with namespaces or separate clusters for strong isolation.
Worked example

Moving a monolith to containers

A retailer is splitting a Java monolith into eight services. Its team has no Kubernetes experience and wants no servers to patch.

The architect chooses ECS on Fargate: each service gets a task definition with its own task role, an ECS service behind a shared Application Load Balancer with path-based routing, and its own CodePipeline pipeline.

A batch service that runs nightly uses a Fargate Spot capacity provider strategy, and the front-end services use Graviton-based Fargate tasks after testing on Arm. If the company later standardises on Kubernetes across its data centres, the images and pipelines can be reused on EKS.

Check yourself

A team needs GPUs for one service and wants no node management for the rest. What capacity mix fits on ECS?

Show answer

Fargate for the general services and an EC2 capacity provider with GPU instances for the GPU service, because Fargate does not offer the GPU instance types that the service needs.

Exam Tips

Remember for the exam

  • Kubernetes skills, manifests or multi-environment portability: EKS; simplest AWS-native orchestration: ECS.
  • No servers or nodes to manage: Fargate (or EKS Auto Mode for managed nodes).
  • GPUs, specific instance types or daemon agents: EC2 capacity.
  • Per-service IAM permissions: ECS task roles or EKS Pod Identity.