Lesson 4 of 6 Container Platforms and Microservices

Scaling Lambda, ECS and EKS Workloads

This lesson explains how Lambda concurrency, ECS service auto scaling, the Horizontal Pod Autoscaler, Karpenter and Application Auto Scaling scale serverless and containerised workloads.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain how reserved, provisioned and event source concurrency settings affect Lambda scaling.
  • Distinguish scaling of tasks or pods from scaling of cluster capacity.
  • Identify the resources that Application Auto Scaling scales.

Scaling Lambda

Lambda scales by running more execution environments, up to the account's concurrency quota. Reserved concurrency both guarantees and caps a function's concurrency, which protects downstream systems such as relational databases; the maximum concurrency setting on an SQS event source mapping limits pollers for that source. Provisioned concurrency keeps initialised environments ready to remove cold starts, and can itself be scaled on a schedule or by utilisation with Application Auto Scaling.

Scaling ECS and EKS

Tasks and pods

ECS service auto scaling, built on Application Auto Scaling, changes a service's desired task count with target tracking (for example average CPU or ALB requests per target), step or scheduled policies; a custom metric such as queue depth per task suits workers. On EKS, the Horizontal Pod Autoscaler changes the number of pod replicas from CPU, memory or custom metrics.

Capacity

With EC2 capacity, ECS capacity providers with managed scaling add or remove instances so that tasks can be placed. On EKS, the Cluster Autoscaler adjusts node groups when pods are pending, and Karpenter launches right-sized instances directly for pending pods and consolidates underused nodes; EKS Auto Mode includes Karpenter-based scaling. With Fargate, only the task or pod level needs scaling.

Troubleshooting scenario

Scaling problems

Exam skills 1.1.9 · 5.4.3

Fix container scaling problems.

Log in to try this activity Interactive activities are free with an account.

Application Auto Scaling as a common engine

AWS Application Auto Scaling scales resources other than EC2 instances through one API: ECS service task counts, DynamoDB read and write capacity, Aurora replicas, SageMaker AI endpoint variants, Lambda provisioned concurrency, Amazon MSK storage and others. Each resource is registered as a scalable target with minimum and maximum capacity and given target tracking, step or scheduled policies.

The following table summarises the scaling mechanism at each level.

WorkloadWork unitsCapacity
LambdaConcurrency (reserved, provisioned, event source maximums)Managed by AWS
ECS on FargateService auto scalingManaged by AWS
ECS on EC2Service auto scalingCapacity providers with managed scaling
EKSHorizontal Pod AutoscalerKarpenter, Cluster Autoscaler or Auto Mode
Worked example

A spiky order pipeline

An order pipeline receives bursts of 20 times normal traffic during flash sales. Orders arrive through API Gateway, are queued in SQS, processed by workers on EKS and written to an Aurora database that accepts at most 500 connections.

The architect scales the worker Deployment with the Horizontal Pod Autoscaler on queue depth per pod (through an external metrics adapter) and lets Karpenter add Spot and On-Demand nodes when pods are pending.

A maximum replica count keeps database connections below the limit, and RDS Proxy pools connections. Before each announced sale, a scheduled action raises the minimum replicas so capacity is ready when the sale starts.

Check yourself

The Horizontal Pod Autoscaler raises replicas, but the new pods stay Pending. What is missing?

Show answer

Node capacity. The HPA scales pods only; Karpenter, the Cluster Autoscaler or EKS Auto Mode must add nodes when pods cannot be scheduled.

Exam Tips

Remember for the exam

  • Protect a database from Lambda surges: reserved concurrency or maximum concurrency on the event source mapping.
  • Cold starts for predictable traffic: provisioned concurrency with scheduled scaling.
  • Pods pending because nodes are full: Karpenter or the Cluster Autoscaler; scale pods on metrics: HPA.
  • One scaling API for ECS, DynamoDB, Aurora replicas and SageMaker AI endpoints: Application Auto Scaling.