How to Register an Additional EC2 Instance to an Existing AWS Elasic Load Balancer (ELB)
Check out how to create an ELB with HTTP support. For scalability as well as for high availability, you will be required to add new instances to an existing load balancer. This guide will show you how to add an EC2 instance to an existing ELB.
Using the AWS UI Console
Login to your AWS account console and enter the EC2 section. Click “Load balancers” on the left pane.
1. Select the Load Balancer and click on the tab “Description”. It will list the ELB info like DNS name and status of an EC2 instance.
2. Click on the tab “Instances”. It will list the current instances as well as the availability zones configured with the ELB. Click on the green & red “+/-” button on the top right of the instances table.
3. You will see all EC2 instances running in that region. Select the instances you want to add to the ELB. It will show the total count of instances selected in each zone at the bottom. If the instances are not distributed evenly, it might show a warning message as marked below. Click “Save”.
[Newvem analyzes your baseline disaster recovery (DR) status, reflecting how well AWS DR best practices have been implemented, and recommends AWS features and best practices to reach optimal availability, increase outage protection, and quick recovery. Learn more Newvem's features]
4. You will see a confirmation message. Click “Close”.
5. It will start the registration process of the additional instances with ELB. Initially, until the instance gets registered with ELB and passes the health check, its status will be “Out Of Service”. If you add an instance from a different availability zone, ELB automatically configures the new zone to route requests to. The new zone will not be healthy until the instance that is part of that zone is registered.
6. Once the instance registration and health check process is complete, it will be in service and the availability zone will be in healthy state.
Using the AWS CLI tools
7. Make sure to setup the CLI tools for the ELB.
9. Set the end point URL of the region.
Check the Instance details using the following command:
Check the health of the ELB instances using:
To add a new instance to an existing ELB, first get the instance ID. Then run the following command:
elb-register-instances-with-lb AWSFirstELB --instances i-81435db2
If the instance is from the zone which is not configured to route requests of ELB, that instance will not be registered with ELB. First register the zone with ELB using:
elb-enable-zones-for-lb AWSFirstELB --availability-zones us-west-2c
After some time, run the command:
It will list all the instances, including the instance added through command line.
10. The command line output for each step is as below.
11. In the previous steps, we have added the availability zone by command. As described before, when you add an instance to an ELB through the AWS console it will configure the new availability zone to route requests automatically.
12. Let’s see how we can manually configure an additional availability zone for ELB to route requests.
13. Go to the instances tab of the ELB. It will list the current configured availability zones. Click on the “+/-” button on the Availability Zones table.
14. It will list all the availability zones of AWS. Select the additional availability zone. If there’s currently no instances from this zone registered with the ELB, it will show a warning message as highlighted below. Click “Save”.
15. On the confirmation message, click “Close”.
16. A new availability zone will be added to the ELB. The new zone will not be in healthy state until a new instance of same zone is added to the zone.
17. Once a new instance from the same zone is added, the status of the availability zone will become healthy.
[Newvem analytics tracks you AWS cloud utilization:
- Hourly Utilization Pattern Analysis
- Reserved Instances Decision Tool
- Resource Resizing Opportunities
Keywords: Amazon web services, Amazon AWS console, Amazon Cloud Services, AWS Management Console, AWS ELB, Elastic Load Balancer, CLI, Command Line Tools, Cloud Cost, AWS API, AWS UI Console, Load balancer, EC2, Instances