Course contentsShow
← Cloud and Infrastructure
Lesson 246 of 2,9895. Load Balancing and Traffic ManagementFree lesson

ALB Listeners and Rules

Learn how listeners accept connections on specific ports and protocols, and how rules route requests to targets.

ALB Listeners and Rules

What you'll learn: How Application Load Balancers use listeners and rules to accept incoming traffic and intelligently route it to the right targets.


How Listeners Work

A listener is a process that checks for incoming connection requests on a specific port and protocol. Think of it like a receptionist at a hotel lobby—they wait at the front desk (a specific location) and greet guests as they arrive.

For an ALB, you configure listeners like:

  • Listen on port 80 for HTTP traffic
  • Listen on port 443 for HTTPS traffic

Each listener must specify:

  • Port number (e.g., 80, 443, 8080)
  • Protocol (HTTP or HTTPS)

When a request arrives at that port/protocol combination, the listener accepts it and processes it according to its rules.

How Rules Route Traffic

Once a listener accepts a connection, rules determine where that request should go. Rules are evaluated in priority order (lowest number first) and consist of:

  • Conditions: What to check in the request (path, hostname, headers, HTTP method)
  • Actions: What to do when conditions match (forward to target group, redirect, return fixed response)

Example scenario:

  • Rule 1: If path is /api/*, forward to API servers target group
  • Rule 2: If path is /images/*, forward to image servers target group
  • Default rule: Forward everything else to main web servers

Rules let you implement sophisticated routing logic—like sending mobile users to different servers or routing based on geographic headers—all at Layer 7.


Key Takeaway: Listeners accept connections on specific ports/protocols, while rules intelligently route those requests to appropriate target groups based on request characteristics like path, hostname, or headers.