Load balancing (for example, layer 4 compared with layer 7, reverse proxies, layer 3)

Task Statement 2.1: Implement routing and connectivity between on-premises networks and the AWS Cloud.

📘AWS Certified Advanced Networking – Specialty


📌 What is Load Balancing?

Load balancing is the process of distributing incoming network traffic across multiple servers or resources to:

  • Improve performance
  • Increase availability
  • Prevent overload on a single server
  • Ensure fault tolerance

🔹 Why it matters in AWS exam

In AWS networking, load balancing is critical because:

  • Applications run on multiple EC2 instances
  • Traffic must be evenly distributed
  • High availability across multiple Availability Zones is required

🔷 Types of Load Balancing by OSI Layers

Load balancing works at different layers of the OSI model. For the exam, you must clearly understand:

  • Layer 3 (Network Layer)
  • Layer 4 (Transport Layer)
  • Layer 7 (Application Layer)

🔶 1. Layer 3 Load Balancing (Network Layer)

📌 Definition

Layer 3 load balancing makes decisions based on:

  • IP addresses (source/destination)

📌 How it works

  • Uses routing techniques
  • Traffic is forwarded based on destination IP
  • Does NOT inspect ports or application data

📌 Characteristics

  • Very fast (minimal processing)
  • Limited intelligence
  • No awareness of applications

📌 Example in IT environment

  • Routers distributing traffic across multiple network paths
  • AWS VPC route tables influencing traffic direction

📌 AWS relevance

  • Route tables
  • Transit Gateway routing decisions
  • Equal-cost multi-path (ECMP)

📌 Key exam point

👉 Layer 3 = IP-based routing decisions only


🔶 2. Layer 4 Load Balancing (Transport Layer)

📌 Definition

Layer 4 load balancing distributes traffic based on:

  • IP address
  • TCP/UDP port numbers

📌 How it works

  • Looks at connection-level data
  • Does NOT inspect application content
  • Works with TCP and UDP

📌 Characteristics

  • High performance and low latency
  • Supports millions of requests
  • Limited intelligence (no content awareness)

📌 Example in IT environment

  • Distributing incoming TCP connections to multiple backend servers
  • Handling database or application traffic without inspecting content

📌 AWS Service

👉 Network Load Balancer (NLB)

🔹 Features of NLB

  • Ultra-high performance
  • Static IP addresses
  • Preserves client IP
  • Handles TCP, UDP, TLS

📌 Key exam point

👉 Layer 4 = connection-based load balancing (IP + port)


🔶 3. Layer 7 Load Balancing (Application Layer)

📌 Definition

Layer 7 load balancing makes decisions based on:

  • HTTP/HTTPS headers
  • URLs
  • Cookies
  • Application data

📌 How it works

  • Inspects full request content
  • Routes traffic based on rules

📌 Characteristics

  • Intelligent routing
  • Content-aware decisions
  • Slightly higher latency than L4

📌 Example in IT environment

  • Routing /api requests to API servers
  • Routing /images requests to image servers
  • Directing traffic based on hostname

📌 AWS Service

👉 Application Load Balancer (ALB)

🔹 Features of ALB

  • Path-based routing
  • Host-based routing
  • Works with HTTP/HTTPS
  • Supports WebSockets

📌 Key exam point

👉 Layer 7 = content-based routing


🔷 Comparison: Layer 3 vs Layer 4 vs Layer 7

FeatureLayer 3Layer 4Layer 7
Decision based onIPIP + PortContent (HTTP/HTTPS)
SpeedFastestVery fastSlower (more processing)
IntelligenceLowMediumHigh
AWS usageRouting tablesNLBALB
Content awareness❌ No❌ No✅ Yes

🔷 Reverse Proxy

📌 Definition

A reverse proxy is a server that:

  • Receives client requests
  • Forwards them to backend servers
  • Returns the response to the client

👉 The client does NOT communicate directly with backend servers.


📌 How it works

  1. Client sends request to reverse proxy
  2. Reverse proxy decides which backend server to use
  3. Backend processes request
  4. Reverse proxy sends response back to client

📌 Functions of Reverse Proxy

  • Load balancing
  • SSL/TLS termination
  • Security (hide backend servers)
  • Caching
  • Request filtering

📌 AWS Example

🔹 Application Load Balancer (ALB)

  • Acts as a Layer 7 reverse proxy

🔹 Network Load Balancer (NLB)

  • Not a full reverse proxy (passes traffic directly)

📌 Key exam point

👉 Reverse proxy = client talks to proxy, not directly to backend


🔷 AWS Load Balancer Types (Important for Exam)

AWS provides three main load balancers:


🔶 1. Application Load Balancer (ALB)

  • Layer 7
  • HTTP/HTTPS only
  • Content-based routing
  • Best for web applications

🔶 2. Network Load Balancer (NLB)

  • Layer 4
  • TCP/UDP/TLS
  • Ultra-high performance
  • Best for low-latency applications

🔶 3. Gateway Load Balancer (GWLB)

  • Layer 3 + Layer 4 (special case)

📌 Purpose

  • Used for security appliances
  • Works with:
    • Firewalls
    • Intrusion detection systems

📌 Key Feature

  • Uses GENEVE protocol
  • Enables transparent traffic inspection

🔷 Advanced Concepts (Exam Important)

🔹 1. Cross-Zone Load Balancing

  • Distributes traffic evenly across all AZs
  • Improves availability

🔹 2. Health Checks

  • Load balancer checks backend server health
  • Removes unhealthy instances automatically

🔹 3. Sticky Sessions (Session Affinity)

  • Sends same user to same backend server
  • Useful for stateful applications

🔹 4. SSL/TLS Termination

  • Load balancer handles encryption/decryption
  • Reduces backend server load

🔹 5. Connection Draining (Deregistration Delay)

  • Allows in-progress requests to complete before removing instance

🔷 When to Use What (Exam Scenarios)

📌 Use Layer 3

  • Routing between networks
  • No application awareness needed

📌 Use Layer 4 (NLB)

  • High performance required
  • TCP/UDP traffic
  • Low latency applications

📌 Use Layer 7 (ALB)

  • Web applications
  • Need routing based on URL/headers
  • Microservices architectures

📌 Use Reverse Proxy

  • Hide backend infrastructure
  • Add security and control
  • Centralized request handling

🔷 Exam Tips (Very Important)

✅ Know differences:

  • L3 vs L4 vs L7
  • NLB vs ALB vs GWLB

✅ Remember:

  • ALB = Layer 7 + Reverse Proxy
  • NLB = Layer 4 + High performance
  • GWLB = Security appliances

✅ Key keywords in questions:

  • “URL-based routing” → ALB
  • “Low latency / TCP” → NLB
  • “Firewall inspection” → GWLB

🔷 Final Summary

  • Layer 3 → IP-based routing
  • Layer 4 → Connection-based (IP + port)
  • Layer 7 → Content-based routing
  • Reverse proxy → intermediary between client and servers
  • AWS uses:
    • ALB (Layer 7)
    • NLB (Layer 4)
    • GWLB (Layer 3/4 for security)
Buy Me a Coffee