Scaling Containers and Their Capacity
This lesson explains how container platforms scale at two levels: the number of tasks or pods, and the capacity those tasks run on.
Learning outcomes
After completing this lesson, you will be able to:
- Explain how tasks and their capacity scale together.
- Explain how capacity provider strategies split tasks.
- Describe how batch and scheduled containers run.
Two layers of scaling
Container platforms scale at two layers, and both must work for the application to grow. The first layer is the number of tasks or pods running the application. In ECS, Service Auto Scaling adjusts a service's task count with target tracking on CPU, memory or ALB requests, or on custom metrics such as the depth of an SQS queue. In EKS, the Horizontal Pod Autoscaler adjusts the number of pod replicas.
The second layer is the capacity the tasks run on. With Fargate this is automatic. On EC2, ECS capacity providers scale an Auto Scaling group to fit the tasks, or mix Fargate and Fargate Spot in chosen proportions. In EKS, Karpenter or the Cluster Autoscaler adds nodes when pods cannot be placed, or EKS Auto Mode manages nodes entirely. The following table summarises the mechanisms.
The following diagram shows the two layers and the mechanisms for each.

Capacity provider strategies
A strategy splits tasks across providers with a base and weights, for example a base of two tasks on Fargate for reliability and the rest weighted 1:3 between Fargate and Fargate Spot to cut cost. On EC2, managed scaling grows the Auto Scaling group as tasks need room.
Scaling containers
Batch and scheduled containers
Not every container serves requests. Batch jobs that must be queued, prioritised and retried run on AWS Batch, which manages job queues and launches the necessary capacity on ECS, EKS or Fargate, including Spot, and scales it down when the queue is empty. Scheduled tasks, such as a nightly report, run as ECS tasks started by EventBridge Scheduler, so no instance has to wait idle for the scheduled time. The following table summarises the choice.
| Need | Use |
|---|---|
| Batch jobs with queues and priorities | AWS Batch on ECS, EKS or Fargate |
| Scheduled tasks | ECS tasks started by EventBridge Scheduler |
Scaling queue workers on Fargate
An ECS service processes jobs from an SQS queue. The backlog varies from zero to 50,000 messages, and the team wants to cut cost.
| Setting | Choice |
|---|---|
| Task scaling metric | Backlog per task, from queue depth divided by running tasks |
| Minimum tasks | One, so work starts immediately |
| Capacity provider strategy | Base of one task on Fargate, the rest weighted towards Fargate Spot |
Because the jobs can be retried, interruptions of Spot tasks cost nothing but time, and the queue keeps the work safe.
What are the two layers of scaling for ECS on EC2?
Show answer
Service auto scaling changes the number of tasks, and a capacity provider with managed scaling changes the number of EC2 instances to fit them.
Exam Tips
Remember for the exam
- To scale ECS tasks on queue depth, use Service Auto Scaling with a custom metric.
- To mix Fargate and Fargate Spot for cost, use a capacity provider strategy.
- To scale Kubernetes nodes quickly and efficiently, use Karpenter.
- For batch container jobs with queues, use AWS Batch.