Overview
A load balancer is a tool that can help boost the resiliency and performance of a website by routing front-end traffic to a number of backend servers. (Often called backend pools) A load balancer will direct incoming web traffic to one of the backend servers to spread out the load, thus improving performance. Should one of the backend servers be inaccessible, the load balancer will route traffic appropriately. Thus, a load balancer can improve the performance of a website but also serves as a failover redundancy option.
This guide will assist in setting up a Load Balancer in Amazon's Web Services (AWS) to manage traffic to the Aptify Web or E-Business websites. It is possible to use an AWS Load Balancer without the web servers and database servers being located in AWS. An AWS Load Balancer can employ as few as two backend web servers to balance but can be expanded to as many as needed for the business scenario.
This documentation will outline the path and process to set up e-Business Classic (HTTP traffic) as well as Aptify Web (HTTPS traffic) though similar methods can be followed to set up an AWS Load Balancer for any other website, such as e-Business 6.
Two important considerations when setting up load balancing:
Public Availability
The examples in this documentation will involve setting up a load balancer for both e-Business Classic and Aptify Web, assuming both websites are intended to be accessible over the public internet. It is possible to set up load balancers for a non-public website, such as if Aptify Web is only accessible on the intranet. However, The load balancer will need to be able to talk to the corresponding backend web servers.
Session Persistence (aka Sticky Sessions)
When setting up a load-balanced environment, there are multiple ways to handle user sessions. The examples in this documentation will use session persistence, also called sticky sessions as that is currently required by both Aptify Web products. Future versions of the product will eliminate this requirement and the documentation will be updated accordingly. e-Business Classic and e-Business 6 web user authentication does not require the use of sticky sessions.
Session persistence means that a user's session will remain on the specific backend web server for as long as that session exists. If a web user logs in to purchase a product from the cart, the load balancer will assign them a specific backend web server or backend pool for the login step. with session persistence, the load balancer will keep that user on that specific backend pool for as long as they are on the website.
If that backend pool fails, restarts, or is inaccessible mid-session, the load balancer will move them to another available backend pool. Since their session information was on the other server, they will be required to log in again, and anything saved in the session will be new. Anything saved in the database server (for example, Saved Cart) should behave normally.
Future versions of these products will allow for the session state to be written somewhere other than in the specific backend pool, so in the event of a user being moved to a different backend pool, that new server could grab the session state as is.
Prerequisites
This guide assumes that all the infrastructure except the Load Balancer has already been set up. You should have:
- A database server running Aptify and/or e-Business and your CMS
- At least two web servers running Aptify Web or e-Business connected to your Database Server
- These web servers must be running the website using the URL that will be used by the load balancer
- For example, if we are load balancing www.ebizsite.org both websites must be set up to use that URL in IIS, web.config, and any other location where the URL is specified
- These web servers need to be accessible to the load balancer, but need not be publicly accessible by themselves
- These web servers must be running the website using the URL that will be used by the load balancer
- A certificate for the URL/domain you intend to use with the load balancer
Set up Instructions
Adding a Load Balancer
Log in to the AWS Management Console and select the EC2 service.
Scroll down the left-hand side until you see Load Balancing- click it.
Select Create Load Balancer
Under Select Load Balancer Type select Application Load Balancer and click Create.
On Step 1: Configure Load Balancer page, enter the following information:
Field | Values |
---|---|
Name | A clear name for your load balancer |
Scheme | Internet-facing (assuming this website will be publicly accessible) |
IP Address Type | IPv4 |
Under the Listeners section, click Add Listener. Add one for both HTTP and HTTPS. If your websites use a different port than the default 80/443 values for HTTP and HTTPS, make sure to change the port number.
Under the Availability Zones section, If your load balancer is set up across Availability Zones, specify the VPC and availability zones.
Click Next to proceed to Step 2: Configure Security Settings
In Step 2, select Choose a certificate from ACM (recommended). If you do not currently have a certificate stored for this load balancer, you will need to add it to your AWS account.
Click Next to proceed to Step 3: Configure Security Groups
Add your Load Balancer to an existing Security Group, or create a new one. You can specify multiple Security Groups if needed.
Click Next to proceed to Step 4: Configure Routing
On the Configure Routing page, enter the following values for an HTTP/non-secure website.
Field | Value |
---|---|
Target Group | New Target Group |
Name | Desired name for new Target Routing Group |
Target Type | Instance |
Protocol | HTTP |
Port | 80 (If your backend sites uses a different port, change this value.) |
Protocol Version | HTTP1 |
For an HTTPS/secure website, change the Protocol to HTTPS and the port should change to 443. (If your backend site uses a different port, change this value.)
Click Next to proceed to Step 5: Register Targets.
On Step 5: Register Targets, select the Instances that you would like to put behind the Load Balancer. If you are adding them behind an HTTP/non-secure load balancer, leave port 80 as set. If you are adding them to HTTPS, change the port to 443 and select Add to registered.
Click Next to go to Step 6: Review page.
Review the configuration of the new Load Balancer. If settings look correct, click Create.
Once created, you should see your new Load Balancer.
Testing Your Load Balancer
Once your Load Balancer has deployed, you can test simply by going to the IP address of your load balancer. If you do not know this, you can find your Load Balancer resource in the AWS portal.
- Open the Amazon Elastic Compute Cloud (Amazon EC2) console.
- Under Load Balancing, choose Load Balancers from the navigation pane.
- Select the load balancer that you are finding IP addresses for.
- On the Description tab, copy the Name.
- Under Network & Security, choose Network Interfaces from the navigation pane.
- Paste the load balancer name that you copied in step 4 in the search box. The filtered results show all elastic network interfaces associated with the load balancer.
- For each of the elastic network interfaces in the filtered results:
Select the elastic network interface.
Choose the Details tab.
Find the interface that contains an IP address for Primary private IPv4 IP. This is the primary private IP address of the elastic network interface.
Navigate to that URL from any machine.
If the Load Balancer is set up properly and the backend pools are healthy, your site should load. You can verify session persistence is working properly by clicking the Site certificate in your browser. If your website is HTTPS and properly setup, it will look like this:
If your certificate is invalid or you're connecting to an HTTP website, it may look like this.
If connecting to the site and basic functionality is confirmed working via IP Address, try connecting using the DNS name. If the DNS mapping is pointed to the Load Balancer's IP address and the certificates are all valid, it should work.
Comments
Please sign in to leave a comment.