Determining an appropriate load balancing strategy (for example,Application Load Balancer [Layer 7] compared with Network Load Balancer[Layer 4] compared with Gateway Load Balancer)

Task Statement 4.2: Design cost-optimized compute solutions.

📘AWS Certified Solutions Architect – (SAA-C03)


1. What is Load Balancing?

A load balancer distributes incoming traffic (requests) across multiple servers (targets) to:

  • Improve availability
  • Increase scalability
  • Prevent overloading a single server
  • Ensure high performance

In AWS, load balancing is provided by Elastic Load Balancing (ELB).


2. Types of AWS Load Balancers

There are three main types:

1. Application Load Balancer (ALB) → Layer 7

2. Network Load Balancer (NLB) → Layer 4

3. Gateway Load Balancer (GWLB) → Layer 3 + 4 (specialized)


3. Understanding OSI Layers (Simple Explanation)

  • Layer 7 (Application Layer) → Understands HTTP/HTTPS content (URLs, headers)
  • Layer 4 (Transport Layer) → Works with TCP/UDP only (no content awareness)

👉 This difference is critical for the exam


4. Application Load Balancer (ALB) – Layer 7

Key Idea:

ALB works at the application level and can make decisions based on the content of the request.

Features:

  • Supports HTTP, HTTPS, WebSocket
  • Performs content-based routing
  • Supports path-based routing
  • Supports host-based routing
  • Integrates with:
    • Containers (ECS, EKS)
    • Microservices
  • Supports authentication (e.g., Cognito)
  • Supports redirects and fixed responses

Routing Capabilities

ALB can route traffic based on:

  • URL path:
    • /api → backend service A
    • /images → backend service B
  • Hostname:
    • app.example.com → app servers
    • admin.example.com → admin servers

When to Use ALB

Use ALB when:

  • You need advanced routing rules
  • Application uses HTTP/HTTPS
  • You are using:
    • Microservices architecture
    • Containers (ECS/EKS)
  • You need user authentication at load balancer level
  • You want cost optimization for HTTP workloads

Exam Tip

👉 If the question mentions:

  • URL-based routing
  • Microservices
  • HTTP/HTTPS

➡️ Answer = ALB


5. Network Load Balancer (NLB) – Layer 4

Key Idea:

NLB works at the transport layer and handles traffic based only on:

  • IP address
  • Port number

It does NOT inspect application content.


Features:

  • Supports:
    • TCP
    • UDP
    • TLS
  • Extremely high performance
  • Handles millions of requests per second
  • Provides ultra-low latency
  • Supports static IP addresses
  • Supports Elastic IP assignment
  • Preserves source IP address

When to Use NLB

Use NLB when:

  • You need very high performance
  • You need low latency
  • You need static IP addresses
  • You are using:
    • Non-HTTP protocols (TCP/UDP)
  • You need to preserve client IP

Exam Tip

👉 If the question mentions:

  • TCP or UDP traffic
  • Static IP
  • High throughput
  • Low latency

➡️ Answer = NLB


6. Gateway Load Balancer (GWLB)

Key Idea:

GWLB is used for network security and inspection.

It distributes traffic to security appliances.


Features:

  • Works with:
    • Firewalls
    • Intrusion Detection Systems (IDS)
    • Intrusion Prevention Systems (IPS)
  • Uses GENEVE protocol
  • Transparent to applications
  • Provides centralized security management

When to Use GWLB

Use GWLB when:

  • You need deep packet inspection
  • You are deploying:
    • Firewalls
    • Security appliances
  • You want centralized security architecture

Exam Tip

👉 If the question mentions:

  • Firewall appliances
  • Traffic inspection
  • Security layer

➡️ Answer = GWLB


7. Key Differences (Very Important for Exam)

FeatureALBNLBGWLB
OSI LayerLayer 7Layer 4Layer 3/4
ProtocolsHTTP, HTTPSTCP, UDP, TLSIP-based
Routing TypeContent-basedIP/Port-basedSecurity routing
PerformanceHighVery HighHigh
LatencyLowUltra-lowModerate
Static IPNoYesYes
Use CaseWeb appsHigh-performance appsSecurity appliances

8. Cost Optimization Considerations

ALB:

  • Cost-effective for HTTP/HTTPS applications
  • Reduces need for complex application logic
  • Charged per request + time

NLB:

  • Better for high-throughput workloads
  • Efficient for long-lived connections
  • Charged per LCU (Load Balancer Capacity Unit)

GWLB:

  • Used only when security inspection is required
  • Adds cost due to additional appliances

9. How to Choose the Right Load Balancer (Decision Guide)

Choose ALB if:

  • You need intelligent routing
  • Application is web-based
  • You are using microservices or containers

Choose NLB if:

  • You need maximum performance
  • You require static IP
  • You use non-HTTP protocols

Choose GWLB if:

  • You need security inspection
  • You are deploying network appliances

10. Common Exam Scenarios

Scenario 1:

Application needs routing based on /api and /images
➡️ ALB


Scenario 2:

Application requires handling millions of TCP requests with low latency
➡️ NLB


Scenario 3:

Traffic must pass through a firewall appliance before reaching servers
➡️ GWLB


Scenario 4:

Need to preserve client IP and use static IP
➡️ NLB


Scenario 5:

Microservices running on containers
➡️ ALB


11. Final Exam Tips (Very Important)

  • Layer 7 = ALB = smart routing
  • Layer 4 = NLB = speed + performance
  • Security appliances = GWLB

👉 Always identify:

  1. Protocol (HTTP vs TCP)
  2. Routing complexity
  3. Performance requirement
  4. Security requirement

Conclusion

To pass this topic in the exam, remember:

  • ALB → Best for web applications and intelligent routing
  • NLB → Best for performance and low-level traffic handling
  • GWLB → Best for security and inspection
Buy Me a Coffee