Objective
To create a new Amazon Elastic Load Balancer (ELB).
Table of Contents
Overview
You can use Amazon's Elastic Load Balancers for load balancing purposes. Windows and Linux ServerTemplates can automatically register and deregister when servers are launched in a deployment or autoscalable array.
For mission critical applications using AWS Elastic Load Balancers, you should configure the ELB to service application servers running in multiple availability zones.

Steps
Create a Load Balancer
Navigate to Clouds > AWS Region > Load Balancing
Select the New or Create ELB action button.
Fill out the form fields:
-
Name - The name of our Elastic Load Balancer. It must be unique within your AWS account.
-
Deployment - (Recommended) Select the deployment where the ELB will be used. An ELB is designed to load balance across a specified pool of application servers in the deployment. If a specific deployment is selected, it will appear under the deployment's Servers tab (below the Arrays section). If a deployment is not selected, the ELB can still service applications servers within a deployment. This is an optional setting.
-
Availability Zones - A checkbox list of the availability zones for which the ELB will service. An ELB will only load balance across instances in the selected availability zones. An ELB is EC2 region-specific; it cannot load balance across multiple EC2 regions. For example, you cannot load balance your application traffic amongst instances in the 'us-east' and 'us-west' regions.
-
Description - Describe the use/function for the elastic load balancer.
Configure the Load Balancer
Elastic Load Balancers support both HTTP and HTTPS (SSL) requests.

By default, the ELB will be configured with the following Listener (HTTP: 80->80). (i.e. The ELB will listen over HTTP on port 80 and forward requests to port 80 on the receiving instances.) However, if you are setting up the ELB to load balance across application servers launched with one of RightScale's v12.11 LTS, v13.5, or newer Infinity release ServerTemplates, you may need to create new listeners for the ELB.
- Go to the Elastic Load Balancer's Listeners tab.
- Check the configuration of the application ServerTemplate to make sure that the application servers are configured to listen for requests from the ELB on the correct port. (e.g. Application Listen Port (8000), LB_PORT (80), etc.)
- If your application servers are configured to listen on the default ELB port (TCP port 80), no changes are required. Proceed to the next section. (e.g. Microsoft IIS App Server)
- If your application servers are configured to listen on a different port (e.g. TCP port 8000), such as the PHP, Rails, Tomcat6, Tomcat7, Django ServerTemplates, delete the default listeners and create new ones with the correct port settings. Follow the steps below to create a new listener.
- For example, to configure HTTP access, add a listener to forward requests to the appropriate port (e.g. 8000) for the application servers. Click New and add a listener with the following configuration.
-
Protocol: Select 'HTTP'
-
Load balancer port: Enter '80'
-
Instance port: Enter '8000'
- To allow HTTPS (SSL) access, add a listener to forward requests to the appropriate port (e.g. 8000) for the application servers. Click New and add a listener with the following configuration.
-
Protocol: Select 'HTTPS'
-
Load balancer port: Enter '443'
-
Instance port: Enter '8000'
-
SSL Certificate: Select an SSL Certificate. See Create an AWS Server Certificate.

Update the DNS Records
Once you've created your ELB, find its DNS name (e.g. elbname-12345678.us-east-1.elb.amazonaws.com) and use it to create a CNAME with your DNS provider. For an ELB, you cannot create a DNS record that points to an IP address because it could change over time.
- Go to the Elastic Load Balancer's Info tab.
- Copy the "DNS name" for the ELB. (e.g. elb-name-2005463590.us-west-1.elb.amazonaws.com)
- Create a CNAME with your DNS provider (e.g. AWS Route53, DNS Made Easy, DynDNS, etc.)
Example: Amazon Route 53

Create a Security Group for Application Servers
The next step is to create or update a security group that will be used by application servers to allows ingress communication from an ELB. By default, RightScale's Linux-based application ServerTemplates (e.g. PHP, Rails, Tomcat) listen on TCP port 8000 and the Windows-based application ServerTemplate (e.g. Microsoft IIS App) listens on TCP port 80.
- Create or modify a security group in the AWS region where the ELB will service requests to the application servers. The security group will be used by the application servers that will be connected to the ELB.
- Create the desired port permissions. At a minimum, you will need to open up port 80 for HTTP access. You can also open up 443 for HTTPS (SSL) access. Specify the following information to create a permission for an ELB.
-
Protocol: TCP
-
Port: 8000..8000 (PHP, Rails, Tomcat); 80..80 (Microsoft IIS)
-
IPs/group: group
-
Owner: amazon-elb
-
Group: amazon-elb-sg

- Later, when you set up your application servers and/or server array, be sure to add the above security group so that the application servers will be able to connect to the Elastic Load Balancers. Note: You cannot add a new security group to a running EC2 instance. In such cases, it's recommended that you add the security group to the "next" server and relaunch the server.