SysPadLessons › compute lessons › ECS Fargate

How ECS Fargate works

Serverless container compute. Run containers without managing EC2 instances. Billed per vCPU-hour and GB-hour. Scales tasks horizontally via ECS service auto-scaling.

ECS is AWS’s own answer to "I have containers, run them for me," without the full weight of Kubernetes. You describe a container in a task definition, and a service keeps the right number of copies alive behind a load balancer. The one big choice: let Fargate run them serverlessly, or run them on EC2 instances you manage.

What you will learn

Task definitions, tasks, and services

A task definition is the blueprint: container image(s), CPU/memory, ports, environment. A task is a running instance of that blueprint. A service runs and maintains a desired number of tasks, replacing failed ones and registering them with a load balancer.

Fargate vs EC2 launch type

The same ECS tasks can run two ways. Fargate is serverless: AWS provides and manages the underlying capacity, you never see an instance. EC2 launch type runs tasks on EC2 instances you provision and operate as a cluster.

Fargate for most teams that just want containers run; EC2 launch type for large, steady, cost-sensitive, or hardware-specific fleets.

Health and scaling

A service watches its tasks: if one crashes or fails health checks, it launches a replacement. Service auto scaling adjusts the desired task count based on metrics (CPU, memory, request rate), and the load balancer spreads traffic across healthy tasks.

ECS vs EKS vs Lambda

Choose ECS for AWS-native container orchestration with less complexity than Kubernetes. Choose EKS when you want Kubernetes itself (its ecosystem, portability, or existing k8s skills/manifests). Choose Lambda for short, event-driven tasks where you don’t even want to think about containers or scaling.

Flashcards

Task definition vs task vs service in ECS?
Task definition = blueprint; task = a running instance of it; service = keeps N tasks alive behind a load balancer.
What does the Fargate launch type remove compared to EC2 launch type?
Managing the underlying servers, Fargate runs tasks on AWS-managed capacity; EC2 launch type means you provision and operate the instances.
When might EC2 launch type beat Fargate?
At steady high scale, or when you need specific hardware (GPUs) or tight bin-packing, it can be cheaper and more controllable, at the cost of running instances.
A container crashes at 3am. What brings it back?
The service, it maintains the desired task count, replacing failed tasks automatically.
ECS vs EKS in one line?
ECS = AWS-native, simpler container orchestration. EKS = real Kubernetes(ecosystem/portability) but heavier to operate.

Sources

Open the SysPad canvas · Official ECS Fargate documentation

Other compute lessons