Load Balancing & Auto Scaling
AWS SAA SAA-C03 · Design Resilient Architectures
Elastic Load Balancing: distributing traffic
An Elastic Load Balancer (ELB) distributes incoming traffic across multiple targets — EC2 instances, containers, IP addresses, or Lambda functions — in one or more Availability Zones. It is the front door of most AWS architectures: users talk to the load balancer, and the load balancer talks to healthy targets. AWS offers three types of load balancer, and the exam tests the choice between them constantly.
| Load balancer | Layer | Best for |
|---|---|---|
| Application Load Balancer (ALB) | Layer 7 (HTTP/HTTPS) | Web applications; content-based routing by path, host, header, or query string; WebSocket and gRPC; integration with WAF and Cognito |
| Network Load Balancer (NLB) | Layer 4 (TCP/UDP) | Extreme performance and low latency; static IP addresses; millions of requests per second; non-HTTP protocols |
| Gateway Load Balancer (GWLB) | Layer 3 | Deploying third-party virtual appliances (firewalls, intrusion detection) transparently in the traffic path |
The ALB is the default answer for HTTP/HTTPS applications. It routes based on the content of the request: /images/* can go to one target group, /api/* to another, and different hostnames to different services. It supports path-based and host-based routing, sticky sessions, slow-start mode for newly added targets, and authentication through Cognito or an OIDC provider. The NLB operates at the transport layer: it is faster, handles volatile traffic patterns and millions of requests per second, preserves the source IP, and provides one static IP address per Availability Zone (or an Elastic IP), which matters when clients or firewalls need to allow-list fixed addresses. The GWLB is a specialist: it routes traffic through virtual network appliances using the GENEVE protocol, so a third-party firewall can inspect traffic without the application being aware of it.
All load balancers use target groups (the set of destinations for traffic) and health checks (periodic probes that determine whether a target is healthy). Traffic only goes to healthy targets, and unhealthy targets are automatically removed from rotation. A load balancer itself is deployed across at least two Availability Zones, and for internet-facing applications it sits in public subnets while its targets sit in private subnets. Cross-zone load balancing distributes traffic evenly across all targets in all enabled AZs; for ALB it is enabled by default, for NLB and GWLB it is disabled by default (and enabling it on NLB incurs cross-AZ data charges).
Auto Scaling: matching capacity to demand
Amazon EC2 Auto Scaling (Auto Scaling groups, or ASGs) maintains a fleet of EC2 instances at the right size. You define a launch template (AMI, instance type, security groups, IAM role, user data), the VPC subnets to launch into (spread across AZs), and the desired, minimum, and maximum number of instances. The ASG continuously replaces instances that fail health checks, which makes it a resilience feature as well as a scaling feature: even with a fixed size, an ASG keeps your fleet healthy by replacing failed instances automatically.
Scaling is driven by scaling policies. Target tracking keeps a metric at a chosen value — for example, average CPU at 50% — adding instances when the metric rises above the target and removing them when it falls. Step scaling adds or removes instances in defined steps based on CloudWatch alarm thresholds. Simple scaling adds or removes a fixed number on a single alarm. Scheduled scaling changes capacity at known times — scale up before the Monday morning rush, scale down on Friday evening. Predictive scaling uses machine learning on historical patterns to scale ahead of recurring demand. The exam's rule of thumb: target tracking is the best default for most workloads; scheduled scaling is for predictable, calendar-based patterns; predictive scaling is for recurring patterns that are hard to express as a schedule.
Two details matter for the exam. Cooldown periods prevent the ASG from launching or terminating instances too rapidly in response to a single event — a cooldown after a scale-out gives new instances time to warm up before the policy evaluates again. And termination policies control which instances are removed during scale-in (by default, the ASG tries to keep the AZs balanced). For applications where the instances themselves are stateful, scale-in can lose data, which is why the exam prefers stateless application tiers behind a load balancer: any instance can be added or removed at any time.
Putting them together
The standard resilient web architecture is an ALB in front of an Auto Scaling group spanning two or more AZs. The load balancer distributes traffic and removes unhealthy targets; the ASG replaces failed instances and scales the fleet with demand. When traffic is predictable, scheduled scaling handles it cheaply; when it is unpredictable, target tracking reacts automatically. Combined with health checks at both layers — the load balancer's checks and the ASG's EC2 and ELB health check types — this pattern gives you an application that survives instance failures, AZ failures, and traffic spikes without manual intervention.
Target groups, health checks, and traffic features
The load balancer's real work happens in its target groups. A target group defines the destinations for traffic and how their health is judged. Targets can be EC2 instances, IP addresses, Lambda functions (ALB only), or another Application Load Balancer. Health checks probe each target at an interval you configure, on a path you choose (for an ALB, an HTTP endpoint such as /health), and a target is marked healthy or unhealthy after a configured number of consecutive successes or failures. Only healthy targets receive traffic. Deregistration delay (also called connection draining) gives a target time to finish in-flight requests before it is removed — important for graceful deployments and scale-in events. Slow start mode on an ALB gradually ramps traffic to a newly registered target over a configurable period, so a cold instance is not immediately flooded with a full share of requests.
Several traffic features appear in exam questions. Sticky sessions bind a user to the same target for the duration of a session using a cookie; they are a workaround for applications that store session state locally, and the better architecture is to externalize the state (see the security guide). An ALB can authenticate users before routing to targets, using Amazon Cognito user pools or any OpenID Connect provider — this offloads authentication from the application entirely. An ALB can also redirect HTTP to HTTPS natively, without a rule on the application. For the NLB, TLS termination offloads decryption from the targets, and preserve client IP is the default behavior, which matters for applications that need the real source address. Cross-zone load balancing distributes traffic evenly across all targets in all enabled AZs: it is on by default for the ALB, and off by default for the NLB and GWLB, where enabling it incurs cross-AZ data charges. When an NLB target group has targets in only one AZ, clients in other AZs still reach it, but their traffic crosses AZ boundaries.
Exam traps to watch for
- Choosing an NLB for content-based routing. Path-based and host-based routing are ALB (Layer 7) features; the NLB operates at Layer 4 and cannot see HTTP paths.
- Forgetting that the NLB is the answer when static IP addresses are required. An ALB's IP addresses change; an NLB provides one static IP per AZ.
- Using simple scaling or manual capacity changes for predictable patterns. Scheduled scaling handles known peaks; target tracking handles the unpredictable rest.
- Treating Auto Scaling as only a scaling feature. An ASG with a fixed size still replaces failed instances automatically — it is a resilience feature too.
Practice questions
Test yourself on this guide. Answers are checked instantly, with a full explanation for each question.
Q1.A company runs a web application with two microservices: requests to /orders should go to the ordering service and requests to /products should go to the catalog service. Both services run on EC2 instances. Which load balancer meets this requirement?
Explanation: Path-based routing is a Layer 7 feature: the ALB inspects the HTTP request path and routes /orders and /products to different target groups. Option D operates at Layer 4 and cannot see HTTP paths. Option C is for inserting virtual network appliances into the traffic path. Option A is the legacy load balancer, which lacks the ALB's advanced routing and is not recommended for new designs.
Exam objective: SAA-C03 Task Statement 3.4: Determine high-performing and/or scalable network architectures
Q2.A financial services company must provide its clients with fixed IP addresses to allow-list in their firewalls. The application handles millions of TCP connections per second with very low latency requirements. Which load balancer should the solutions architect choose?
Explanation: The NLB provides one static IP address per Availability Zone (or an Elastic IP), operates at Layer 4 for extreme throughput and ultra-low latency, and preserves the source IP — all three requirements point to it. Option B cannot provide static IPs (its addresses change) and adds Layer 7 processing overhead. Option A is for virtual appliances, not for serving application traffic directly. Option D is a self-managed single point of failure that cannot match the NLB's scale.
Exam objective: SAA-C03 Task Statement 3.4: Determine high-performing and/or scalable network architectures
Q3.A company's web traffic is highly predictable: it peaks every weekday between 8 AM and 6 PM and drops sharply overnight and on weekends. The company wants to minimize EC2 cost while always having enough capacity during peak hours. Which Auto Scaling approach is MOST cost-effective?
Explanation: The pattern is calendar-based and fully predictable, so scheduled scaling is the precise tool: capacity rises before the known peak and falls when it ends, with no idle instances overnight. Option C would also work but reacts to load rather than anticipating it, and can lag behind a sharp 8 AM ramp. Option D pays for peak capacity around the clock, wasting most of it at night. Option A is manual, error-prone, and not a design the exam rewards.
Exam objective: SAA-C03 Task Statement 4.2: Design cost-optimized compute solutions
Q4.A company runs a stateless web application on EC2 instances in an Auto Scaling group with a fixed size of 4 instances. One instance fails its health check. What does the Auto Scaling group do?
Explanation: Maintaining desired capacity is the ASG's core job: when an instance fails a health check, the ASG terminates it and launches a replacement automatically, keeping the fleet at 4 healthy instances. Option A misunderstands the ASG — fixed size means the count stays at 4, not that failed instances are left in place. Option D is wrong because replacement is automatic, not manual. Option C is wrong: the ASG maintains the desired capacity, it does not lower it when an instance fails.
Exam objective: SAA-C03 Task Statement 2.2: Design highly available and/or fault-tolerant architectures
Q5.A company wants to inspect all traffic entering its VPC with a third-party firewall appliance before the traffic reaches the application servers. The inspection must be transparent to the application. Which load balancer should the solutions architect use?
Explanation: The Gateway Load Balancer is designed to route traffic through third-party virtual appliances (firewalls, intrusion detection systems) transparently, using the GENEVE protocol — the application sees the traffic as if the appliance were not there. Option B and D distribute traffic to application targets; they do not insert network appliances into the path. Option A is a CDN for caching and delivering content, not a mechanism for transparent appliance inspection.
Exam objective: SAA-C03 Task Statement 1.2: Design secure workloads and applications
Q6.An Auto Scaling group uses target tracking to maintain average CPU utilization at 50%. During a traffic spike, CPU rises to 85%. What does the Auto Scaling group do?
Explanation: Target tracking works like a thermostat: when the metric (average CPU) rises above the target (50%), the ASG adds instances to spread the load and bring the average back down; when it falls below the target, instances are removed. Option A is backwards — removing instances would raise CPU further. Option D is wrong: target tracking acts automatically. Option B is wrong: Auto Scaling changes the number of instances, not their size.
Exam objective: SAA-C03 Task Statement 3.2: Design high-performing and elastic compute solutions
Q7.A solutions architect is designing a highly available web application. The Application Load Balancer and Auto Scaling group should span multiple Availability Zones. Where should the load balancer and the EC2 instances be placed?
Explanation: The load balancer needs public subnets to receive internet traffic, and the instances belong in private subnets for security; spreading both across two AZs means the failure of one AZ leaves a working load balancer and working instances in the other. Option A reverses the placement: a load balancer in private subnets cannot receive internet traffic, and instances in public subnets are exposed. Options B and D put everything in one AZ, so a single AZ failure takes the application down.
Exam objective: SAA-C03 Task Statement 2.2: Design highly available and/or fault-tolerant architectures
Q8.A company's application experiences unpredictable traffic spikes. The Auto Scaling group is configured with a cooldown period of 300 seconds after scale-out events. During a spike, the group launches new instances, but CPU remains high for several minutes. What is the effect of the cooldown period?
Explanation: A cooldown period pauses further scaling actions after a scale-out, so the ASG does not keep launching instances in response to the same spike while the newly launched instances are still warming up and not yet reducing the average CPU. Option A is the opposite of what happens during scale-out. Option D is wrong: cooldowns do not change the group's size limits. Option B is wrong: health checks continue to run during a cooldown.
Exam objective: SAA-C03 Task Statement 3.2: Design high-performing and elastic compute solutions