Fargate and ECS capacity
Where ECS tasks run: Fargate and Fargate Spot, ECS Managed Instances, your own Auto Scaling groups, capacity provider strategies and sizing.
ECS task definitions and servicesEC2 pricing, Spot and Savings PlansLaunch templates and Auto Scaling groups
Fargate and ECS capacity
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- ECS schedules tasks onto capacity. Fargate, ECS Managed Instances and your own EC2 instances differ in how much of the machine you operate.
- Fargate runs each task with no instance to manage. You pick from fixed CPU and memory combinations and cannot run privileged containers or GPUs.
- ECS Managed Instances gives you EC2 instance choice while AWS provisions, patches and replaces the hosts, draining them after 14 days.
- A capacity provider strategy splits tasks with a base and weights, for example a guaranteed floor on Fargate and the rest on Fargate Spot.
- Fargate Spot tasks get a two-minute warning as SIGTERM and an event. Fargate does not fall back to on-demand for you.
- On your own Auto Scaling group, two loops must work: service scaling adds tasks and capacity provider managed scaling adds instances.
Tasks need somewhere to land
A service says “keep six of these running”. Something has to supply the CPU and memory. That supply is capacity, and choosing it is mostly choosing how much of a server you want to be responsible for.
Think of transport. A taxi takes you there and you never think about engines. A leased fleet with a maintenance contract lets you pick the vehicles while someone else services them. Owning the fleet gives full control and every chore. ECS offers all three.
Fargate
With Fargate there is no instance in your account. You give a task a size, and it runs with its own network interface. You pay for the vCPU and memory of each task while it runs.
Sizes come from a fixed menu. A few rows from the docs:
| CPU | Memory choices |
|---|---|
| 0.25 vCPU | 512 MiB, 1 GB, 2 GB |
| 1 vCPU | 2 to 8 GB |
| 4 vCPU | 8 to 30 GB |
| 16 vCPU | 32 to 120 GB in 8 GB steps |
The menu goes up to 32 vCPU. x86 and ARM64 are both available. Ephemeral disk starts at 20 GiB and can be raised to 200 GiB. There are no privileged containers, no GPUs, no daemon services, and few Linux capabilities can be added.
AWS maintains the platform underneath and periodically retires tasks running on old revisions. A service replaces them; a task you started by hand is simply stopped.
Managed Instances and your own EC2
ECS Managed Instances sits in the middle. Tasks run on real EC2 instances in your account, chosen automatically or to your requirements, including GPUs and specific CPU types. Several tasks can share a larger instance. AWS handles provisioning, scaling and patching, and starts draining an instance after 14 days so it gets replaced. Work that must run longer than that on one host doesn’t fit. You pay for the instances plus a management charge.
EC2 with an Auto Scaling group is the oldest option. You choose the AMI, patch it, and run the agent. It’s worth it when you need host-level control, want to use existing Savings Plans or Spot in your own way, or need to tune the host.
Capacity providers
Every cluster has the FARGATE and FARGATE_SPOT capacity providers, and you can add providers for Auto Scaling groups or Managed Instances. A capacity provider strategy on a service spreads tasks across them:
"capacityProviderStrategy": [
{"capacityProvider": "FARGATE", "base": 2, "weight": 1},
{"capacityProvider": "FARGATE_SPOT", "weight": 3}
]
base is a floor filled first, and only one entry may set it. weight divides the rest. With 10 tasks this gives 4 on Fargate (2 base plus a quarter of 8) and 6 on Spot. AWS recommends strategies over the older launchType setting.
Fargate Spot is spare capacity at a discount. When AWS wants it back you get a two-minute warning, as an EventBridge event and a SIGTERM in the container. Handle the signal. If no Spot capacity exists, the service keeps retrying; it will not quietly buy on-demand instead. That is why the base matters.
Two scaling loops
On Fargate you scale tasks and you’re done. On an Auto Scaling group there are two layers. Service auto scaling changes how many tasks you want. Cluster auto scaling, turned on through the capacity provider’s managed scaling, changes how many instances exist. ECS publishes CapacityProviderReservation, roughly instances needed over instances running, and scales the group toward your target. A target below 100 keeps spare room so new tasks don’t wait for a machine to boot.
Choosing and sizing
Start with Fargate. Move to Managed Instances when you need hardware Fargate lacks or bin packing makes a real difference to the bill. Run your own hosts when you can name the control you need.
Size from measurements. Watch actual CPU and memory use under load. Memory is a hard wall, since a container that exceeds it is killed, while too little CPU shows up as latency. Many small tasks across zones fail more gracefully than a few big ones.
About the video
The embed is a clip (1:20 to 37:29) of an AWS re:Invent 2025 session on choosing compute with Fargate and ECS Managed Instances. Its chapters in that range are an overview of ECS, capacity provisioning, security and compliance, and cost optimisation. I judged it from chapters and description only, since transcripts couldn’t be fetched. English was judged from its English caption track and title. An older, shorter comparison of EC2 and Fargate is in deeper.
What was run: nothing. No emulator can show placement, Spot interruption or host replacement. Everything here is from the AWS docs, checked 2026-11-29, and the placement arithmetic is worked by hand from the documented base and weight rules.
Where this fits
That’s ECS. The other way to run containers on AWS keeps the Kubernetes API: EKS.
Check yourself
A task needs a GPU. Can it run on Fargate?
No. Fargate does not support the gpu parameter. Use ECS Managed Instances with instance requirements that include accelerators, or EC2 instances you manage.
You set a strategy with base 2 on FARGATE, then weight 1 on FARGATE and weight 3 on FARGATE_SPOT, and ask for 10 tasks. How are they placed?
The first 2 go to FARGATE to satisfy the base. The other 8 follow the 1 to 3 weights, so 2 more on FARGATE and 6 on FARGATE_SPOT.
Your service scales to 20 tasks but 8 stay pending on an EC2 cluster. CPU on existing instances is fully reserved. What is missing?
Something that adds instances. Use an Auto Scaling group capacity provider with managed scaling, or check that its maximum size is high enough. Service auto scaling only changes the desired task count.
Why must a container on Fargate Spot handle SIGTERM?
It is the two-minute notice that the capacity is being taken back. The application should stop accepting work and finish or hand off what it has, before it is killed after the stop timeout.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.