Ends in

AWS Cloud Practitioner Sale - Get a Chance to Win FREE Access to our new DEA Practice Exams

Guided Lab: Creating Your First Application Load Balancer


Application Load Balancer (ALB) operates at the application layer (Layer 7 of the OSI model) and is designed to route HTTP/HTTPS traffic. But why use an ALB? While one can host an application on a single EC2 instance or vertically scale an instance for more resources, there are limits.

ALB is usually used when:

  1. High availability is required: ALB can route traffic across multiple Availability Zones (AZs). If an instance in one AZ fails, ALB redirects traffic to healthy instances in other AZs.
  2. Using Auto Scaling Groups (ASG) for dynamic scaling: ALB integrates seamlessly with EC2 Auto Scaling. Together, they help you create a multi-AZ environment that lets you scale out when the need arises. Instead of scaling a single instance vertically, you can simply add more instances when you need them, avoiding the fuss of resizing an EC2 instance.
  3. HTTP-based routing is desired: ALB supports various request routing based on HTTP parameters. This enables use cases like:
    1. Path-based routing: Directs client requests to specific services based on the URL path. For instance, /images could route to an image server while /api goes to an API server.
    2. Host-based routing: Routes requests based on the domain name. Useful for hosting multiple domains on a single load balancer.
    3. HTTP header routing: Routes traffic based on headers, query parameters, or HTTP methods.


This lab assumes you have experience creating EC2 instances and are familiar with its basic components.

If you find any gaps in your knowledge, consider taking the following labs:

  • Creating an Amazon EC2 instance (Linux)
  • Setting up a Web server on an EC2 instance
  • Launching an EC2 Instance with User Data


In this lab, we’ll set up two EC2 instances to demonstrate how an ALB distributes traffic visually. One will display a red web page, and the other a blue one. As you access the ALB, the page colors will switch, representing the load distribution between instances.