Application Load Balancer (ALB)

An Application Load Balancer (ALB) is an AWS service that operates at the Application Layer (Layer 7) of the OSI model. It is designed to route and distribute HTTP, HTTPS, and WebSocket traffic to targets such as EC2 instances, containers, Lambda functions, and on-premises servers. ALB provides advanced routing features based on application content, making it ideal for modern, distributed, and microservices-based architectures.

Key Features of ALB:

  1. Layer 7 Routing:

    • Routes traffic based on application-specific content, such as HTTP headers, request paths, or hostnames.
  2. Host-Based and Path-Based Routing:

    • Routes requests to different target groups based on domain names (host-based) or URL paths (path-based).
  3. Support for WebSocket and HTTP/2:

    • Ensures compatibility with modern web application protocols for improved performance and user experience.
  4. SSL Termination:

    • Offloads SSL/TLS encryption and decryption from the backend servers, improving performance.
  5. Containerized and Serverless Workloads:

    • Natively integrates with Amazon ECS, EKS, and Lambda for seamless load balancing of containerized and serverless applications.
  6. Sticky Sessions:

    • Ensures user requests are consistently routed to the same target for session persistence.
  7. Health Checks:

    • Monitors the health of targets in a target group and routes traffic only to healthy instances.
  8. Dynamic Scaling:

    • Automatically scales up or down based on traffic demand.

Use Cases:

  1. Microservices:

    • Distributes traffic among multiple services, routing requests based on URLs or hostnames.
  2. Web Applications:

    • Balances traffic for high-traffic websites and applications, ensuring reliability and scalability.
  3. SSL/TLS Offloading:

    • Simplifies certificate management and reduces backend server load by terminating SSL at the load balancer.
  4. Containerized Workloads:

    • Load balances traffic across containers running on Amazon ECS or Kubernetes.

Examples of Real-Time Application Load Balancer

Application Load Balancer (ALB)
Scenario:

  • You are running an e-commerce website with multiple microservices for user authentication, product catalog, and payments.

  • ALB routes traffic based on the URL path:

    • /login → directs to the authentication microservice.

    • /products → directs to the catalog microservice.

    • /payment → directs to the payment microservice.
      Why ALB?

  • It supports path-based routing and integrates seamlessly with microservices, ensuring intelligent traffic distribution.

Summary:

Application Load Balancer (ALB)

  • Layer: Operates at Layer 7 (Application Layer).

  • Purpose: Advanced routing for HTTP/HTTPS traffic.

  • Features:

    • Path-based and host-based routing.

    • WebSocket and HTTP/2 support.

    • Native integration with microservices and containerized applications (e.g., ECS).

    • Authentication via Cognito or OIDC.

  • Use Cases:

    • Microservices architecture.

    • Web applications requiring intelligent routing.