7.4 Container Orchestration — ECS, EKS, and ECR

Key Takeaways

  • Amazon ECR (Elastic Container Registry) is a managed Docker registry for storing, managing, and deploying container images with lifecycle policies.
  • ECS Service Auto Scaling adjusts the number of tasks based on metrics (CPU, memory, ALB request count, custom CloudWatch metrics).
  • ECS Anywhere and EKS Anywhere let you run containers on your own on-premises infrastructure while managing them through AWS.
  • ECS supports service discovery via AWS Cloud Map and service mesh via AWS App Mesh for microservices communication.
  • Use ECS for simpler container orchestration; EKS when you need Kubernetes compatibility; Fargate when you want zero server management.
Last updated: March 2026

Container Orchestration — ECS, EKS, and ECR

Quick Answer: ECR stores container images. ECS orchestrates Docker containers (AWS-native). EKS runs Kubernetes (standard K8s). Both support Fargate (serverless) or EC2 (self-managed nodes). Use ECS for simplicity, EKS for Kubernetes compatibility, and ECR for image management.

Amazon ECR (Elastic Container Registry)

ECR is a fully managed Docker container registry.

FeatureDetail
StorageStores Docker and OCI images
EncryptionImages encrypted at rest with KMS
ScanningAutomatic vulnerability scanning (integrated with Inspector)
Lifecycle policiesAutomatically clean up old/untagged images
Cross-RegionReplication for multi-Region deployments
Cross-accountShare images across accounts via repository policies
Public registryECR Public Gallery for public images

ECS Advanced Features

ECS Service Auto Scaling

MetricScaling Trigger
ECS Service CPUScale when average CPU exceeds target
ECS Service MemoryScale when average memory exceeds target
ALB Request CountScale based on requests per target
Custom CloudWatchScale on any custom metric

ECS Service Discovery (AWS Cloud Map)

FeatureDetail
PurposeServices find each other by name instead of IP
DNS-basedCreates Route 53 records automatically
API-basedServices can query Cloud Map API
Health checksAutomatic health checking of registered services

ECS Task Placement Strategies

StrategyDescription
binpackPlace tasks on fewest instances (cost optimization)
spreadDistribute across AZs or instances (availability)
randomRandom placement

ECS Capacity Providers

ProviderDescription
FargateServerless — AWS manages instances
Fargate SpotSpot pricing for Fargate tasks (up to 70% savings)
EC2 Auto Scaling GroupYour managed EC2 instances

EKS Advanced Features

EKS Node Types

TypeDescription
Managed Node GroupsAWS manages EC2 instances for worker nodes
Self-managed NodesYou manage EC2 instances (maximum control)
FargateServerless — no nodes to manage

EKS Pricing

ComponentCost
Control plane$0.10/hour ($73/month)
Worker nodesEC2 or Fargate pricing
FargatePer vCPU and memory per second

Decision Matrix

RequirementBest Choice
Simplest container orchestrationECS on Fargate
Kubernetes compatibility requiredEKS
Maximum cost optimization for containersECS on EC2 with Spot + Fargate Spot
Hybrid containers (on-premises + cloud)ECS Anywhere or EKS Anywhere
Short-lived batch containersECS/EKS on Fargate
GPU workloadsECS/EKS on EC2 (GPU instances)

On the Exam: "Run containers with the least operational overhead" → ECS/EKS on Fargate. "Container image management with vulnerability scanning" → ECR with image scanning. "Cost-optimize Fargate containers" → Fargate Spot capacity provider.

Test Your Knowledge

A company needs microservices running in containers to discover each other by service name without hardcoding IP addresses. Which AWS service enables this?

A
B
C
D
Test Your Knowledge

Which ECS task placement strategy minimizes the number of EC2 instances used (and therefore cost)?

A
B
C
D
Test Your Knowledge

A company wants to reduce the cost of their ECS Fargate tasks for a batch processing workload that can tolerate interruptions. Which option provides the highest cost savings?

A
B
C
D
Test Your Knowledge

A company stores container images in Amazon ECR. They notice old, untagged images are consuming significant storage. How should they automate cleanup?

A
B
C
D