Quantcast
Channel: SeattleIT.Net
Viewing all articles
Browse latest Browse all 20

Registering Amazon EC2 Instances on Multiple ELB’s

$
0
0

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:

user@server ~ # elb-describe-lbs LOAD_BALANCER

test-1 test-1-8523956045.us-west-1.elb.amazonaws.com 2011-04-26T19:10:59.222Z
LOAD_BALANCER test-2 test-2-8523958370.us-west-1.elb.amazonaws.com
2011-04-26T19:11:12.600Z

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):

--lb
--instances i-XXXXXXXX i-YYYYYYYY i-ZZZZZZZZ
--region us-west-1

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:

user@server ~ # elb-register-instances-with-lb --lb test1 \
--instances i-XXXXXXXX i-YYYYYYYY --region us-west-1

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:

user@server ~ # elb-enable-zones-for-lb test-1 --region us-west-1 \
--availability-zones us-west-1b us-west-1c

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.


Viewing all articles
Browse latest Browse all 20

Trending Articles