Currently viewing the tag: "Elastic Load Balancers"

I’ve come across the issue several times recently, where the Amazon Web Services (AWS) Management Console does not allow you to register instances on more than one Elastic Load Balancer (ELB).

The key to getting around this issue is to use the ELB API tools after creating an ELB (whether it be through the management console or through the EC2 API).

Step #1: Install the Amazon ELB API Tools

If you do not already have the Amazon ELB API tools installed and your shell environment setup, you can grab them from Amazon using the resources below:

»Elastic Load Balancing API Tools Download

»Elastic Load Balancing Documentation

Step #2: Gather Required Instance Parameters

Once you have downloaded the ELB API tools and have your environment setup correctly, the next step is to identify the parameters needed to register the AMI(s) to the ELB. These instructions presume you have a Linux or UNIX terminal shell.

First, run the following command to list the active ELB’s:

The second column of the command output will be used to for the ELB target variable “–lb”. In order to register instances to ELB’s, we will need the following information to construct the API call (using elb-register-instances-with-lb):

You can use the Amazon EC2 API tools to gather the instance ID(s) and the region information for the instances or use the AWS Management Console to do so. Take note of the option syntax in the –instances parameter, if you plan to register multiple instances to the ELB.

Once you have these parameters in place, use the following command to register the instances with the ELB:

After running the above command, you should see the newly registered instance ID’s listed in the stdout on your terminal screen.

Step #3: Enable Availability Zones for the ELB

The final step in the process is to assess which availability zones your newly added instances are located in. If for example they are spanned across multiple availability zones, you can ensure the ELB will server them all as shown in the following example:

Repeat the above steps to add instances to additional ELB’s as needed. You can then verify with either the Amazon EC2 API tools or with the Management Console that, in fact, your multiple ELB’s are load balancing the instances.