A company runs microservices with HTTP/HTTPS traffic. They need to route requests to different target groups based on the URL path — /api/* goes to the API service and /web/* goes to the web service. Which load balancer type supports this?
- AClassic Load Balancer (CLB) — Layer 4/7 but no content-based routing rules.
- BApplication Load Balancer (ALB) — Layer 7, supports path-based and host-based routing rules.✓ Correct
- CNetwork Load Balancer (NLB) — Layer 4 (TCP/UDP), no HTTP-level routing.
- DGateway Load Balancer (GWLB) — for deploying third-party network appliances, not app routing.
ALB operates at Layer 7 and can inspect HTTP headers, paths, and hostnames. It supports listener rules for path-based routing (e.g., /api/* → Target Group 1) and host-based routing (api.example.com vs web.example.com). NLB operates at Layer 4 and does not inspect HTTP content. CLB is the legacy option with limited routing.
A trading platform requires millions of requests per second with ultra-low latency, and the application needs to see the original client's source IP address without using HTTP headers. Which load balancer is MOST appropriate?
- AApplication Load Balancer — terminates connections and adds X-Forwarded-For header with client IP.
- BNetwork Load Balancer — Layer 4, preserves the client source IP address and handles millions of RPS with sub-millisecond latency.✓ Correct
- CClassic Load Balancer — older generation with limited performance and no source IP preservation for TCP.
- DGateway Load Balancer — for inline inspection with virtual appliances, not application traffic.
NLB operates at Layer 4 (TCP/UDP/TLS). It can handle millions of requests per second with ultra-low latency. It preserves the client source IP by default (unlike ALB which uses X-Forwarded-For). NLB also supports static/Elastic IP addresses and is ideal for applications requiring IP whitelisting.
A company's ALB routes traffic to EC2 instances. They want users to always be sent to the same EC2 instance during their shopping session. Which ALB feature enables this?
- ACross-Zone Load Balancing — distributes traffic evenly across all registered targets in all enabled AZs.
- BSticky Sessions (Session Affinity) — uses a cookie to bind a user session to a specific target.✓ Correct
- CConnection Draining (Deregistration Delay) — allows in-flight requests to complete before deregistering an instance.
- DHost-Based Routing — routes traffic based on the Host header in the HTTP request.
Sticky sessions (also called session affinity) work by inserting a cookie (AWSALB for ALB, AWSELB for CLB) in the response. Subsequent requests from the same client are routed to the same target for the duration of the sticky period. Note that stickiness can cause uneven load distribution.
What is the purpose of "Connection Draining" (also called "Deregistration Delay") in Elastic Load Balancing?
- AIt increases connection capacity by pre-warming the load balancer during traffic spikes.
- BIt allows in-flight requests to complete before the load balancer stops sending traffic to a deregistering or unhealthy instance.✓ Correct
- CIt drains connections to reduce AWS costs during off-peak hours.
- DIt prevents new connections to unhealthy instances by marking them as draining.
When deregistering an instance (e.g., during a deployment or scale-in), ELB stops sending new requests to it but keeps existing connections open until they complete or the deregistration delay timeout expires (default 300 seconds, configurable 0–3600 seconds). This ensures graceful request completion without dropped connections.
An ALB distributes traffic to EC2 instances across 3 AZs — two AZs have 5 instances each and one AZ has only 1 instance. With cross-zone load balancing ENABLED, how is traffic distributed across the 11 instances?
- AEach AZ receives exactly 33.3% of traffic regardless of instance count.
- BTraffic is distributed evenly across all 11 instances — each instance receives approximately 9.09% of traffic.✓ Correct
- CAZs with more instances receive proportionally more total traffic.
- DThe AZ with only 1 instance is excluded from traffic routing.
With cross-zone load balancing enabled (default for ALB, optional/extra cost for NLB), the load balancer distributes requests evenly across ALL registered targets in all enabled AZs, regardless of which AZ the request enters. Without cross-zone LB, each AZ node only routes to targets within that AZ, leading to uneven distribution when AZs have different instance counts.