Introduction to the Application Load Balancer
The Application Load balancer is AWS' premier load balancer. Although the Network Load Balancer is faster, the Application Load Balancer is capable of the greatest number of features due to its ability to make decisions based on the "Application Layer", or layer 7 of the OSI model. This allows your Application Load Balancer to route traffic more intelligently between your instances. In this learning activity, you will create an Application Load Balancer and a Target Group that will be attached to an existing Auto Scaling Group. This will get you ready to deploy your own ALBs within your deployments and step them up to layer 7!
Introduction to Application Load Balancers
This lab takes an introductory look at the Application Load Balancers. Along the way, we will create a Target Group and attach it to an existing Auto Scaling Group. Then we will be ready to create an Application Load Balancer to balance traffic between the instances.
The written portion focuses on the steps necessary to complete the lab. Watch the accompanying video for more description.
Your lab environment has been pre-configured with an Auto Scaling Group. The fine details of the Auto Scaling Group aren't as important as understanding it's general purpose of adding or removing instances that each run our application.
We want to create a new Target Group that we can associate to the existing Auto Scaling Group. Once we do that, the target group will keep track of any instances spun up by the Auto Scaling Group.
Create a New Target Group
- Navigate to the Target Groups section of the EC2 Management Console.
- Click the Create Target Group button.
- Name it
lab-target-groupand click Create.
Associate the Target Group to the Auto Scaling Group
- Navigate to the Auto Scaling Groups link in the EC2 Management Console.
- Click on the existing Auto Scaling Group to view its properties.
- Use the Edit button and add the
lab-target-groupto the Target Groups text field.
- Save the changes.
(If you check out the properties of our new target group and click the Instances tab, you will see the instances that were created by the Auto Scaling Group.)
Application Load Balancer
Now that we have created a Target Group and associated it with the Auto Scaling Group, we are ready to create the Application Load Balancer.
- Navigate to the Load Balancers section and Create Load Balancer.
- Select Application Load Balancer and Continue to the next step.
- Type a name of
lab-load-balancerand ensure that it's
internet facing(we want to be able to view the web page hosted by the instances).
- For the VPC setting, select the VPC that is available.
- We will select both availability zones and choose the public subnets in each (since it's internet facing).
- Continue on to the next step.
We can ignore the warning about HTTPS for this lab, but take note of it and consider your options in practice. Continue with the next step to Configure Security Groups.
- Select the Security Group created when the lab started (not the default).
- Click Next: Configure Routing. We want to choose an Existing Target Group and select our
- Leave all other options unchanged and continue through the rest of the steps.
Once you're finished, you will be able to see the new load balancer being provisioned in the Load Balancers section. Once the Status changes to active, we are ready to navigate to its DNS Name in our browsers.
Copy and paste the DNS Name of the
lab-load-balancer we just created into a new tab. If you see the example web page, everything has been configured. Any traffic to that DNS Name will be load balanced across any instances that are spun up by the Auto Scaling Group.