AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-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...

Configuring Elastic Load Balancing Using AWS Toolkit for Eclipse

Elastic Load Balancing is an Amazon web service that improves the availability and scalability of your application. With Elastic Load Balancing, you can distribute application loads between two or more Amazon EC2 instances. Elastic Load Balancing improves availability through redundancy, and it supports traffic growth for your application.

Elastic Load Balancing automatically distributes and balances incoming application traffic among all the EC2 server instances you are running. The service also makes it easy to add new instances when you need to increase the capacity of your application.

AWS Elastic Beanstalk automatically provisions Elastic Load Balancing when you deploy an application. Under Load Balacing, on the Configuration tab inside the Toolkit for Eclipse, you can edit the AWS Elastic Beanstalk environment's load balancing configuration.

The following sections describe the Elastic Load Balancing parameters you can configure for your application.

Ports

The load balancer provisioned to handle requests for your AWS Elastic Beanstalk application sends requests to the Amazon EC2 instances that are running your application. The provisioned load balancer can listen for requests on HTTP and HTTPS ports and route requests to the Amazon EC2 instances in your AWS Elastic Beanstalk application. By default, the load balancer handles requests on the HTTP port. At least one of the ports (either HTTP or HTTPS) must be turned on.

Important

Make sure that the port you specified is not locked down; otherwise, users will not be able to connect to your AWS Elastic Beanstalk application.

Controlling the HTTP port

To turn off the HTTP port, you select OFF from the HTTP Listener Port drop-down list. To turn on the HTTP port, you select an HTTP port (for example, 80) from the drop-down list.

Note

If you want to access your environment using a different port other than the default port 80 (e.g., port 8080), you can add a listener to the existing load balancer and configure the new listener to listen on that port. For example, using the Elastic Load Balancing command line tools, type the following command replacing <yourloadbalancername> with the name of your load balancer for Elastic Beanstalk.

elb-create-lb-listeners --lb <yourloadbalancername> --listener "protocol=http, lb-port=8080, instance-port=80"
            		

If you want Elastic Beanstalk to monitor your environment, do not remove the listener on port 80.

Controlling the HTTPS port

Elastic Load Balancing supports the HTTPS/TLS protocol to enable traffic encryption for client connections to the load balancer. Connections from the load balancer to the EC2 instances are done using plaintext. By default, the HTTPS port is turned off.

To turn on the HTTPS port

  1. Create and upload a certificate and key to the AWS Identity and Access Management (IAM) service. The IAM service will store the certificate and provide an Amazon Resource Name (ARN) for the SSL certificate you've uploaded. For more information on creating and uploading certificates, see the Managing Server Certificates section of Using AWS Identity and Access Management.

  2. Specify the HTTPS port by selecting a port from the HTTPS Listener Port drop-down list.

  3. In the SSL Certificate ID text box, enter the Amazon Resources Name (ARN) of your SSL certificate (e.g., arn:aws:iam::123456789012:server-certificate/abc/certs/build). Use the SSL certificate that you created and uploaded in step 1. For information on viewing the certificate's ARN, see Verify the Certificate Object topic in the Creating and Uploading Server Certificates section of the Using IAM Guide.

To turn off the HTTPS port, select OFF from the HTTPS Listener Port drop-down list.

Health Checks

The health check definition includes a URL to be queried for instance health. By default, AWS Elastic Beanstalk uses TCP:80 for non-legacy containers and HTTP:80 for legacy containers. You can override the default URL to match an existing resource in your application (e.g. ‘/myapp/index.jsp’) by entering it in the Application Health Check URL box. If you override the default URL, then AWS Elastic Beanstalk uses HTTP to query the resource. To check if you are using a legacy container type, see Why are some container types marked legacy?.

You can control the settings for the health check using the EC2 Instance Health Check section of the Load Balancing panel.

The health check definition includes a URL to be queried for instance health. Override the default URL to match an existing resource in your application (e.g. ‘/myapp/index.jsp’) by entering it in the Application Health Check URL text box.

The following list describes the health check parameters you can set for your application.

  • In the Health Check Interval (seconds) text box, enter the number of seconds that define the interval at which Elastic Load Balancing will check the health of your application's Amazon EC2 instances.

  • Specify the number of seconds for Elastic Load Balancing to wait for a response before it considers the instance non-responsive in the Health Check Timeout (seconds) text box.

  • Specify the number of consecutive successful or unsuccessful URL probes before Elastic Load Balancing changes the instance health status in the Healthy Check Count Threshold and Unhealthy Check Count Threshold text boxes. For example, specifying 5 in the Unhealthy Check Count Threshold text box means that the URL would have to return an error message or timeout five consecutive times before Elastic Load Balancing considers the health check "failed."

Sessions

By default, a load balancer routes each request independently to the server instance with the smallest load. By comparison, a sticky session binds a user's session to a specific server instance so that all requests coming from the user during the session are sent to the same server instance.

AWS Elastic Beanstalk uses load balancer-generated HTTP cookies when sticky sessions are enabled for an application. The load balancer uses a special load balancer-generated cookie to track the application instance for each request. When the load balancer receives a request, it first checks to see if this cookie is present in the request. If so, the request is sent to the application instance specified in the cookie. If there is no cookie, the load balancer chooses an application instance based on the existing load balancing algorithm. A cookie is inserted into the response for binding subsequent requests from the same user to that application instance. The policy configuration defines a cookie expiry, which establishes the duration of validity for each cookie.

Under Load Balancer, in the Sessions section specify whether or not the load balancer for your application allows session stickiness.

For more information on Elastic Load Balancing, go to the Elastic Load Balancing Developer Guide.