This story was written with the assistance of an AI writing program.
Your service needs a load balancer on AWS. The console offers Application and Network. Which one?
The layer decides. Each type can only route on what it can see.
An Application Load Balancer works at Layer 7. It reads the HTTP request and routes on URL path, headers, method, query parameters, or source IP. Targets can be instances, IP addresses, or Lambda functions. Targets learn the client IP from the X-Forwarded-For header it adds.
A Network Load Balancer works at Layer 4. It handles millions of requests per second, pins each TCP connection to one target for the life of the connection, and gets a static IP per Availability Zone, with an optional Elastic IP. Depending on target type, it can preserve the client's real IP at the target - no header parsing needed.
Check what you are actually running:
aws elbv2 describe-load-balancers --query 'LoadBalancers[*].[LoadBalancerName,Type]' --output table
The Type column says application or network.
Takeaway: if the routing decision needs anything inside the HTTP request, that is an ALB. If clients speak TCP or UDP directly, you need a static IP, or targets must see the client IP at the network layer instead of trusting a forwarded header, that is an NLB.
Top comments (0)