AWS Certified Cloud Practitioner / Other Compute Services: ECS, Lambda, Batch, Lightsail

ECS, Fargate & ECR Overview

🧠 Core Idea

Containers can't run on their own β€” they need a platform to launch and manage them. AWS gives you three services for that:

  • Amazon ECS β€” runs containers on EC2 instances you manage

  • AWS Fargate β€” runs containers with no servers to manage

  • Amazon ECR β€” stores the Docker images ECS/Fargate deploy

Knowing how these three fit together is a key exam concept.


πŸ“¦ Amazon ECS (Elastic Container Service)

ECS is AWS's managed container orchestration service β€” it deploys and runs your Docker containers.

AWS handles the container lifecycle (start, stop, monitor, schedule), but you provide the compute: you launch and maintain the EC2 instances that host the containers.

Think of ECS as deciding:

  • Which container runs, and where

  • When it starts or stops

  • How work spreads across your EC2 instances

It also pairs well with an Application Load Balancer for scalable web apps.

πŸ’‘How it works:

  1. Launch EC2 instances

  2. ECS agent installs automatically (ECS-optimized AMIs)

  3. Register instances with an ECS cluster

  4. Store your Docker image in a registry

  5. Create an ECS task

  6. ECS places the container on an available instance

  7. ECS monitors and manages it


πŸš€ AWS Fargate

Fargate also runs Docker containers β€” but you never create or manage EC2 instances. AWS handles the infrastructure behind the scenes.

You just specify:

  • The Docker image

  • CPU needs

  • Memory needs

AWS launches the container automatically. No servers to provision = serverless container service.

πŸ’‘How it works:

  1. Store your Docker image

  2. Specify CPU/memory

  3. Deploy the container

  4. AWS provisions infrastructure automatically

  5. Container runs β€” no EC2 management involved


βš–οΈ ECS vs. Fargate

πŸ”Ή

πŸ“¦ ECS

πŸš€ Fargate

Infrastructure

You manage EC2

AWS manages it

Provisioning

Required

None

Control

High

Simpler, less control

Best for

Infrastructure-level customization

Serverless simplicity

Both run Docker containers on AWS β€” the real difference is who manages the servers.


πŸ—‚οΈ Amazon ECR (Elastic Container Registry)

Before ECS or Fargate can run a container, they need an image to pull from. Amazon ECR is AWS's private Docker image repository β€” a secure place to store images before deployment.

πŸ’‘How it works:

  1. Build a Docker image

  2. Push it to ECR

  3. ECS or Fargate pulls the image from ECR

  4. AWS runs a container from it


πŸ”— How They Work Together

  • ECR stores your Docker images

  • ECS or Fargate retrieves those images

  • The image becomes a running container

  • Your app goes live

Docker Image β†’ Amazon ECR β†’ Amazon ECS or AWS Fargate β†’ Running Container


πŸŽ“ Exam Tips

  • ECS = containers on EC2 you manage

  • Fargate = containers, serverless

  • ECR = private Docker image storage

  • Both ECS and Fargate can deploy images stored in ECR

  • "Where are Docker images stored on AWS?" β†’ ECR

  • "Serverless way to run containers?" β†’ Fargate


🧠 Key Takeaways

Service

You Manage

Serverless?

Use Case

ECS

EC2 instances

No

Run containers on your own EC2s

Fargate

Nothing

Yes

Run containers serverlessly

ECR

Docker images

N/A

Store & manage Docker images