Elastic Load Balancing
Developer Guide (API Version 2012-06-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Using Elastic Load Balancing

Elastic Load Balancing makes it easy for you to distribute application load to your Amazon EC2 instances. Load balancing increases the availability and scalability of your applications. This section discusses some common Elastic Load Balancing user scenarios, and it walks you through the various tasks needed to accomplish efficient distribution of application loads among your Amazon EC2 instances.

Before you explore the Elastic Load Balancing scenarios, be sure that you have done the following tasks:

  • Determined the region in which your EC2 instances will run.

    The examples in this guide assume that your EC2 instances are in the US East (Northern Virginia) Region. If your instances are in Europe, you can specify the EU (Ireland) Region by using the --region eu-west-1 parameter from the command line interface or by setting the AWS_ELB_URL environment variable.

    For more information on using the region parameter with your Elastic Load Balancing commands, go to the Elastic Load Balancing Quick Reference Card. For information on setting your environment variable, see Installing the Command Line Interface. For information about this product's Regions and endpoints, go to Regions and Endpoints in the Amazon Web Services General Reference.

  • Decided on the listener configurations for your load balancer. For a quick overview of the different configurations available for your load balancer, see Elastic Load Balancing Listener Configurations Quick Reference.

  • Decided whether you want to load balance your instances launched in Amazon Elastic Compute Cloud (Amazon EC2) or the instances launched within Amazon Virtual Private Cloud (Amazon VPC).

Amazon EC2 provides features such as security groups that can be used for creating and managing the load balancers within Amazon EC2. For information about the using features specific to instances launched within Amazon EC2, see Deploy Elastic Load Balancing in Amazon EC2-Classic.

Amazon VPC lets you define a virtual networking environment in a private, isolated section of the Amazon Web Services (AWS) cloud and launch EC2 instances in that environment. Elastic Load Balancing on Amazon VPC works in a similar manner to the way it works in Amazon EC2, and it supports the same set of features. There are however some differences in the procedures for associating your load balancer with the instances. For information on creating and managing load balancers within Amazon VPC, see Deploy Elastic Load Balancing in Amazon VPC.

Elastic Load Balancing associates your load balancer with your EC2 instances using IP addresses. When an instance is stopped and then restarted, the IP addresses associated with your instance change. In such cases, we recommend that you de-register your Amazon EC2 instance from your load balancer after you stop your instance, and then register the load balancer with your instance after you've restarted. For detailed instructions on de-registering and registering instances, see De-Register and Register Amazon EC2 Instances.

Elastic Load Balancing supports the load balancing of applications using HTTP, HTTPS (Secure HTTP), TCP, and SSL (Secure TCP) listener protocols. You can specify the protocols for the front-end connections (client to load balancer) and the back-end connections (load balancer to back-end instance) independently. You choose configurations for the front-end and the back-end connections when you create your load balancer. You can also later add listener to your existing load balancer, or delete a listener from your existing load balancer.

If you are using HTTPS/SSL protocol for your listeners, you might have an SSL server certificate installed on your load balancer. You will have to update this certificate periodically. For information on updating your existing SSL certificate, see Update an SSL Certificate for a Load Balancer.

Each Elastic Load Balancing instance that you create has a unique Domain Name System (DNS) name. If you'd prefer to have a custom domain name instead of the load balancer DNS name, you can use Amazon Route 53 to create a custom domain name and associate it with your load balancer DNS name. For more information, see Use Domain Names with Elastic Load Balancing.

The load balancer uses a special load-balancer-generated cookie to track the application instance for each request. After the application instance is tracked, the cookie is inserted in the response for binding subsequent requests from the same user to that application instance. Elastic Load Balancing allows you to configure policies to establish the duration of validity of these cookies. For more information about configuring policies for load-balancer-generated cookies, see Enable Duration-Based Session Stickiness.

The load balancer uses a special cookie to associate the session with the original server that handled the request, but follows the lifetime of the application-generated cookie corresponding to the cookie name specified in the policy configuration. Elastic Load Balancing allows you to configure policies for application-generated cookies if the application cookie is explicitly removed or expires. For more information about configuring policies for application-generated cookies, see Enable Application-Controlled Session Stickiness.

Elastic Load Balancing provides data about your load balancers and your back-end application instances to Amazon CloudWatch. Amazon CloudWatch collects the data and presents it as readable, near real-time metrics. For more information on viewing and interpreting your load balancer metrics, see Monitor Your Load Balancer Using Amazon CloudWatch.

For information on deleting an existing load balancer, see Delete Your Load Balancer.