- Connecting AWS and Azure via VPN - Wed, Aug 14 2019
- MaxPowerSoft Active Directory Reports Professional - Tue, Jun 11 2019
- Load balancing two EC2 instances - Thu, Dec 13 2018
Elastic Load Balancing (ELB) is an offering through Amazon Web Services (AWS) that provides various load-balancing capabilities. The Amazon ELB service offers three different types of load balancers, including Application Load Balancers, Network Load Balancers, and Classic Load Balancers. This tutorial will walk you through the process of deploying and configuring an Application Load Balancer. You will configure the load balancer to load balance IIS instances across two Amazon EC2 instances.
Prerequisites
Prior to load balancing IIS across two EC2 instances, you must first decide on which two Availability Zones you'll deploy your EC2 instances to. Each instance should belong to a separate Availability Zone.
Be sure to configure your virtual private cloud (VPC) with at least one public subnet in each Availability Zone. You'll use these public subnets to configure the Application Load Balancer later. The EC2 instances you deploy can go into other subnets of these Availability Zones.
After deploying an EC2 instance in each Availability Zone, install IIS on each instance. You should also make sure the security groups for these EC2 instances allow HTTP access on port 80.
Create and configure the Application Load Balancer
To begin the load-balancing process, create the load balancer by browsing to the Amazon EC2 console.
Specify a region for your load balancer from the navigation bar. You should choose the same region you deployed the EC2 instances into.
Next, click Load Balancers, located under LOAD BALANCING in the left navigation pane.
Click Create Load Balancer.
Click the Create button under Application Load Balancer to begin the configuration of the load balancer.
From the Configure Load Balancer page, configure the load balancer and listener. Start by providing a name for the load balancer in the Name field.
Ensure that the name you use for the load balancer is unique within your existing set of Application and Network Load Balancers for the region you've chosen.
For this exercise, you can leave the Scheme and IP address type settings at their defaults. You can do the same for Listeners, keeping the default listener that accepts HTTP traffic on port 80.
Under Availability Zones, choose the VPC you used for the EC2 instances you deployed. Select the Availability Zones you deployed the EC2 instances to.
Click Next: Configure Security Settings.
In this tutorial, we are not load balancing HTTPS, so for this exercise, just click Next: Configure Security Groups.
Configure a security group for the load balancer
The Application Load Balancer must be able to communicate with the machines it is load balancing, over the ports/protocols it is load balancing. As such, the security group for the load balancer must allow communication with the registered targets on the listener port and on the health-check port.
From the Configure Security Groups page, create a security group for your load balancer. To do so, click Create a new security group. Provide a name and description for the security group you are creating.
The new security group automatically contains a rule allowing traffic to the listener port you configured on the Configure Load Balancer page.
After providing the name and description, click Next: Configure Routing.
Configure your target group
The target group is used in request routing. The default HTTP (port 80) rule created routes requests to the specified targets in the target group. The load balancer monitors the health of the target instances in this target group using the health-check settings defined for the group.
To configure the target group, leave the default setting of New target group in the Target group field.
Provide a name for the target group in the Name field and leave the Target type, Protocol, and Port values at their defaults (Instance, HTTP, and Port 80).
Leave the default settings for Health checks.
After configuring routing, click Next: Register Targets.
Register targets with your target group
With the target group configured, you can now register targets (EC2 instances, in the case) with the target group. To register the instances with the target group, from the Register Targets page, select your two EC2 instances, keep the default port (80), and then click Add to registered.
After you've added the two instances, click Next: Review.
Complete the setup
At this point, you can complete the setup of the load balancer. Review all the settings you chose.
To complete the setup of the Application Load Balancer, click Create on the Review page. Once you've received the notification that AWS created the load balancer successfully, click Close.
Browse to the LOAD BALANCING section in the navigation pane on the left and click Target Groups.
Select the target group you've created, click on the Targets tab, and verify that your EC2 instances are healthy. Once the status of at least one of the instances shows as healthy, you can test the Application Load Balancer.
To test the load balancer, click Load Balancers located on the navigation pane under LOAD BALANCING.
Choose your new load balancer.
Open the Description tab and copy the DNS name of the load balancer. Paste the name into your favorite web browser and browse it. If everything is working as expected, your browser will display the default IIS page.
Subscribe to 4sysops newsletter!
Congratulations! You have configured an Application Load Balancer to load balance IIS between two EC2 instances.
Read the latest IT news and community updates!
Join our IT community and read articles without ads!
Do you want to write for 4sysops? We are looking for new authors.