Pricing Login
Pricing
Support
Demo
Interactive demos

Click through interactive platform demos now.

Live demo, real expert

Schedule a platform demo with a Sumo Logic expert.

Start free trial
Back to blog results

May 7, 2017 By Graham Watts

An Introduction to the AWS Application Load Balancer

I’ve recently received some questions about the AWS Application Load Balancer, what advantages it provides, and how to monitor it. AWS is already calling the original Elastic Load Balancer it’s ‘Classic’ Load Balancer, so if you’re anxious to understand why so many are using it over the Classic ELB, this post is for you.

This post will describe the AWS Application Load Balancer, when to use it, and introduce how to connect it with your EC2 instances and autoscaling groups. Additional resources on integrating ECS Containers with the Application Load Balancer are also provided.

Operational Visibility From AWS

Machine data holds hidden secrets that deliver true insights about the operational health of your AWS infrastructure. Learn more about operational visibility from AWS today!

Monitoring the AWS Application Load Balancer

What is it the AWS Application Load Balancer?

The AWS Application Load Balancer is the newest load balancer technology in the AWS product suite. Some of the benefits it provides are:

  • Path Based Routing
    • Select where to send requests based on the path of http request
    • This allows for multiple Target Groups behind a single Application Load Balancer, with EC2 and Container support
    • For example, you might route general requests to one target group of containers/EC2s, and route requests to render images to another microservice-specific (image rendering) target group
    • See AWS’s documentation here for a full overview
  • Containerized Application Support
    • Specify dynamic ports in the ECS container task definition
    • When a new task is added to the fleet, the ECS schedule auto-assigns it to the ALB using that port
    • Share the ALB amongst multiple services using path-based routing
    • Improve cost efficiency by running more components of your application per EC2 fleet
      *See AWS’s announcement here for more details
  • Better Health Checks
    • Specify a custom set of HTTP response codes as a ‘healthy’ response
healthcheck-response-codes
  • HTTP/2 Support, WebSockets Support
    • See this AWS post for more details
  • New Pricing Model
    • You pay per hours ALB is running
    • You also pay for the number of Load Balancer Capacity Units (LCU’s) used
    • Only the largest dimension for LCUs is used to calculate your bill
      • Active Connections: 1 LCU = 3000 active connections per minute
      • New Connections: 1 LCU = 25 new connections per second
      • Bandwidth: 1 LCU = 2.22 Mb per second

AWS Application Load Balancer vs. Classic Load Balancer

Despite the enhanced functionality of the ALB, there are a few reasons you might elect to use the Classic Load Balancer for your stack:

  • Your application requires Application Controlled Sticky Sessions (rather than duration based)
  • Your application needs to distribute TCP/IP requests – this is only supported with the Classic Load Balancer

If you’re looking for containerized application support, path based routing, better health checks, websocket support, or HTTP/2 support, the Application Load Balancer is the right choice for you.

How do I use it?

First, you’ll need to create your load balancer. A description of how to do this can be found in AWS’s documentation here. Make sure you make the following selections while setting up the load balancer:

  • Step 1:
    • Set ‘Scheme’ to ‘Internet Facing’ and make sure there is a Listener on port 80 (HTTP)
    • Select the Default VPC, or if launching the ALB into another VPC, select one where you have testing servers running or are able to launch servers for testing
  • Step 3: Create or use an existing security group that allows inbound HTTP traffic of port 80
  • Step 4: Create a new Target Group and select port 80/protocol HTTP
  • Step 5: Skip for now and create the load balancer

Distribute Traffic to Existing EC2 Instances

Check ALB Configuration

  1. Before you begin, verify that your ALB has a Listener set to port 80 – we will test with HTTP requests although when using your load balancer in production make to only allow interactions via HTTPS port 443
    • To verify, go to the EC2 Dashboard > Load Balancers > Select your ALB > Select the ‘Listeners’ tab
  2. Next, double check that the Application Load Balancer’s security group allows inbound HTTP and HTTPS inbound traffic
    • To check this, go to the EC2 Dashboard > Load Balancers > Select your ALB > Under ‘Description’ click on ‘Security group’ > Make sure the correct security group is selected and choose the ‘Inbound Rules’ tab

Send AWS Application Load Balancer Traffic to an EC2 Instance

If you have an existing test server located in the same VPC as your ALB, follow these steps:

  1. First, navigate to the EC2 Dashboard > Load Balancers > Select your ALB > Select ‘Targets’ tab > Select ‘Edit’
  2. Select the test server(s) you want to distribute traffic to and click ‘Add to Registered’, then click ‘Save’

If you want to create a test server to connect to the ALB, follow these steps:

  1. Launch a Linux AMI (see documentation here for more info). While launching, you must ensure that:
    • Step 3: You have selected the same VPC as the VPC your ALB was launched into
    • Step 3: You have a running web server technology and a sample web page – under ‘Advanced Details’ you can use the following bootstrap script if you are not familiar with this:
      #!/bin/bash
      yum install httpd -y
      service httpd start
      mkdir /var/www/html/test
      echo 'Your Application Load Balancer test page!' > /var/www/html/test/index.html
    • Step 6: Allow inbound HTTP traffic from your ALB’s security group
  2. Now that you have a running web server to test with, navigate to the EC2 Dashboard > Load Balancers > Select your ALB > Select ‘Targets’ tab > Select ‘Edit’
  3. Select the test server(s) you want to distribute traffic to and click ‘Add to Registered’, then click ‘Save’

Finally, test your load balancer by navigating to its DNS name in a web browser. You can find it by selecting your ALB and viewing the ‘Description’ tab. Use the pattern <DNS_Name>/test/index.html to see our test page:

Distribute Traffic to EC2s in AutoScaling Groups

If you do not already have a launch configuration, create one following the same steps described above for launching a test Linux AMI server. To configure an Auto Scaling Group to auto-register instances to the ALB, see the documentation here.

The most important step in the ‘Create Auto Scaling Group’ process is under ‘Advanced Details’. Make sure to check the ‘Receive traffic from one or more load balancers’ box and add your ALB:

Distribute Traffic to Your Containers

Complete visibility for DevSecOps

Reduce downtime and move from reactive to proactive monitoring.

Categories

Sumo Logic cloud-native SaaS analytics

Build, run, and secure modern applications and cloud infrastructures.

Start free trial
Graham Watts

Graham Watts

Graham Watts is an AWS Certified Solutions Architect and Sales Engineer at Sumo Logic.

More posts by Graham Watts.

People who read this also enjoyed