Bird
Raised Fist0
AWScloud~10 mins

ALB vs NLB decision in AWS - Visual Side-by-Side Comparison

Choose your learning style10 modes available
Process Flow - ALB vs NLB decision
Start: Incoming Client Request
↓
Choose Load Balancer Type
↓
Application Load Balancer
↓
Inspect HTTP/HTTPS
↓
End Decision
This flow shows how a client request is routed through either an Application Load Balancer (ALB) or a Network Load Balancer (NLB) based on protocol and use case.
Execution Sample
AWS
Client sends HTTPS request
Load Balancer inspects request
If HTTP/HTTPS -> ALB routes by URL
If TCP/UDP -> NLB routes by IP/port
This example shows how the load balancer type is chosen based on the incoming request protocol and how it routes traffic accordingly.
Process Table
StepIncoming Request ProtocolLoad Balancer Type ChosenRouting MethodUse Case
1HTTPSALBRoute by URL, Host, HeadersWeb apps, microservices
2TCPNLBRoute by IP, PortExtreme performance, static IP
3UDPNLBRoute by IP, PortLow latency, millions of connections
4HTTPALBRoute by URL, Host, HeadersSupports WebSockets, HTTP/2
5Unknown ProtocolNoneNo routingRequest rejected or error
💡 Execution stops when request protocol is identified and routed or rejected if unsupported.
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4Final
Incoming Request ProtocolNoneHTTPSTCPUDPHTTPUnknown
Load Balancer TypeNoneALBNLBNLBALBNone
Routing MethodNoneURL/Host/HeadersIP/PortIP/PortURL/Host/HeadersNone
Use CaseNoneWeb appsPerformanceLow latencyWebSocketsRejected
Key Moments - 3 Insights
Why does ALB route based on URL and headers but NLB routes based on IP and port?
ALB works at the application layer (HTTP/HTTPS) so it can inspect URL and headers (see execution_table rows 1 and 4). NLB works at the transport layer (TCP/UDP) and routes by IP and port without inspecting content (rows 2 and 3).
What happens if the incoming request uses an unsupported protocol?
The load balancer cannot route the request, so it is rejected or causes an error (see execution_table row 5). This is why protocol detection is critical.
Why choose NLB for extreme performance and static IPs?
NLB operates at a lower network layer, handling millions of connections with very low latency and supports static IP addresses (rows 2 and 3), making it ideal for high-performance needs.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what load balancer type is chosen for an HTTPS request at step 1?
ANLB
BALB
CNone
DBoth ALB and NLB
💡 Hint
Check the 'Load Balancer Type Chosen' column in execution_table row 1.
At which step does the load balancer reject the request due to unsupported protocol?
AStep 2
BStep 3
CStep 5
DStep 4
💡 Hint
Look for 'No routing' or 'Rejected' in the 'Routing Method' and 'Use Case' columns.
If the incoming request protocol changes from TCP to HTTP, how does the routing method change according to the execution_table?
AFrom IP/Port to URL/Host/Headers
BFrom URL/Host/Headers to IP/Port
CNo change in routing method
DRouting method becomes None
💡 Hint
Compare routing methods in rows 2 (TCP) and 4 (HTTP) of the execution_table.
Concept Snapshot
ALB vs NLB Decision:
- ALB handles HTTP/HTTPS at app layer, routes by URL, headers
- NLB handles TCP/UDP at network layer, routes by IP and port
- Choose ALB for web apps, microservices, WebSockets
- Choose NLB for high performance, static IP, millions of connections
- Unsupported protocols cause request rejection
Full Transcript
This visual execution shows how AWS load balancers decide routing based on incoming request protocols. When a client sends a request, the system checks the protocol. If it is HTTP or HTTPS, the Application Load Balancer (ALB) is chosen. ALB routes traffic by inspecting URL, host, and headers, supporting web applications and microservices. If the protocol is TCP or UDP, the Network Load Balancer (NLB) is chosen. NLB routes traffic by IP address and port, providing high performance and static IP support. If the protocol is unsupported, the request is rejected. Variables like Incoming Request Protocol, Load Balancer Type, Routing Method, and Use Case change step-by-step as the request is processed. Key moments clarify why ALB and NLB route differently and what happens with unsupported protocols. The quiz tests understanding of load balancer choice and routing methods based on protocol.

Practice

(1/5)
1. Which AWS load balancer should you choose if you want to route HTTP requests based on URL paths?
easy
A. Gateway Load Balancer
B. Network Load Balancer (NLB)
C. Classic Load Balancer
D. Application Load Balancer (ALB)

Solution

  1. Step 1: Understand ALB routing capabilities

    ALB can route HTTP/HTTPS traffic based on content like URL paths or host headers.
  2. Step 2: Compare with NLB capabilities

    NLB routes at the network level and does not inspect HTTP content for routing.
  3. Final Answer:

    Application Load Balancer (ALB) -> Option D
  4. Quick Check:

    Content-based routing = ALB [OK]
Hint: Use ALB for HTTP content routing, not NLB [OK]
Common Mistakes:
  • Choosing NLB for HTTP content routing
  • Confusing Classic Load Balancer with ALB
  • Assuming NLB can inspect HTTP headers
2. Which protocol is primarily supported by Network Load Balancer (NLB) for fast, low-latency traffic?
easy
A. TCP/UDP
B. FTP
C. HTTP/HTTPS
D. SMTP

Solution

  1. Step 1: Identify NLB protocol support

    NLB is designed to handle TCP and UDP traffic for fast, low-latency connections.
  2. Step 2: Exclude HTTP/HTTPS protocols

    HTTP/HTTPS are application layer protocols handled by ALB, not NLB.
  3. Final Answer:

    TCP/UDP -> Option A
  4. Quick Check:

    NLB = TCP/UDP traffic [OK]
Hint: NLB handles TCP/UDP, ALB handles HTTP/HTTPS [OK]
Common Mistakes:
  • Selecting HTTP/HTTPS for NLB
  • Confusing FTP or SMTP as NLB protocols
  • Assuming NLB supports application layer protocols
3. You have a web application that requires routing requests based on hostnames and needs SSL termination. Which load balancer will correctly handle this?
medium
A. Network Load Balancer (NLB)
B. Gateway Load Balancer
C. Application Load Balancer (ALB)
D. Classic Load Balancer

Solution

  1. Step 1: Check hostname-based routing support

    ALB supports routing based on hostnames, which is needed here.
  2. Step 2: Confirm SSL termination capability

    ALB can terminate SSL connections, simplifying certificate management.
  3. Final Answer:

    Application Load Balancer (ALB) -> Option C
  4. Quick Check:

    Hostname routing + SSL termination = ALB [OK]
Hint: SSL termination and hostname routing need ALB [OK]
Common Mistakes:
  • Choosing NLB which lacks hostname routing
  • Assuming Classic Load Balancer supports advanced routing
  • Confusing Gateway Load Balancer with ALB
4. A developer configured a Network Load Balancer to route HTTP traffic and expects it to inspect URL paths for routing. Why is this setup incorrect?
medium
A. NLB does not support TCP traffic
B. NLB cannot inspect HTTP content for routing decisions
C. NLB requires SSL certificates for HTTP routing
D. NLB only supports routing based on IP addresses

Solution

  1. Step 1: Understand NLB routing capabilities

    NLB operates at the network layer and cannot inspect HTTP content like URL paths.
  2. Step 2: Identify why HTTP content inspection fails

    Routing based on URL paths requires application layer inspection, which only ALB supports.
  3. Final Answer:

    NLB cannot inspect HTTP content for routing decisions -> Option B
  4. Quick Check:

    NLB lacks HTTP content inspection [OK]
Hint: NLB works at network layer, no HTTP content routing [OK]
Common Mistakes:
  • Thinking NLB supports HTTP path routing
  • Confusing TCP support with HTTP inspection
  • Assuming SSL certs fix routing issues
5. You need to design a system that handles millions of TCP connections with very low latency and also routes HTTP requests based on URL paths. What is the best load balancer setup?
hard
A. Use NLB for TCP connections and ALB for HTTP routing
B. Use only an Application Load Balancer (ALB) for all traffic
C. Use only a Network Load Balancer (NLB) for all traffic
D. Use Classic Load Balancer for both TCP and HTTP traffic

Solution

  1. Step 1: Identify requirements for TCP and HTTP traffic

    Millions of TCP connections need low latency, best handled by NLB. HTTP routing by URL paths requires ALB.
  2. Step 2: Combine load balancers for best performance

    Use NLB for TCP traffic and ALB for HTTP traffic to meet both needs efficiently.
  3. Final Answer:

    Use NLB for TCP connections and ALB for HTTP routing -> Option A
  4. Quick Check:

    TCP low latency + HTTP routing = NLB + ALB [OK]
Hint: Combine NLB for TCP and ALB for HTTP routing [OK]
Common Mistakes:
  • Using only ALB for TCP traffic causing latency
  • Using only NLB missing HTTP routing features
  • Choosing Classic Load Balancer for modern needs
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard