Subscribe to Our Weekly Newsletter
Creating AWS Load Balancers
The following steps will instruct you on how to create a Load Balancer:
1) Firstly, you need to define a load balancer. To do this:
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- In the “Navigation” pane, select “US East (Virginia)” from the “Region” drop-down menu.
- Click on “Load Balancers” on the Navigation pane.
The console will then display the Load Balancers pane.
- On the Load Balancers pane, click “Create Load Balancers”.
- On the “DEFINE LOAD BALANCER” page of the “Create a New Load Balancer” wizard, you will be required to enter a name for your load balancer. In this example, we will type it as “MyLB”.
- We will leave the “Listener Configuration” set to the default value for this example.
- Click on the “Continue” tab.
Now, the “CONFIGURE HEALTH CHECK” page on the “Create a New Load Balancer” wizard page will open up.
2) You are now required to configure the health check. The following steps will help you do so:
- As a routine, Elastic Load Balancing always checks the health of each load-balanced Amazon EC2 instance. Upon finding an unhealthy instance, it stops sending traffic to the particular instance, and also reroutes the traffic to other healthy instances. On the “CONFIGURE HEALTH CHECK” page of the “Create a New Load Balancer” wizard, you are required to set the “Configuration Options” for your load balancer. For this particular example, we will leave “Ping Protocol” set to its default value. However, while deploying your own application, you should specify the HTTPS. For further information on using HTTPS with Elastic Load Balancing, please refer to Elastic Load Balancing Security Features in the Elastic Load Balancing Developer Guide.
- For this particular example, we will leave the “Ping Port” field set to the default value of 80. Ping Port is used by Elastic Load Balancing to send health check queries to one’s Amazon EC2 instances.
Note: Upon specifying a port value, all Amazon EC2 instances owned by you must accept incoming traffic on the same port that you have specified for health check. You are allowed to set a different port value other than 80. You can also set this value at a later time. However, for this particular example, we will keep it set to 80.
- In the “Ping Path” field, you will need to replace the default value with a single forward slash (/). Elastic Load Balancing sends all health check queries to the path that you have specified in the ping path. For this particular example, we will use a single forward slash, so that the Elastic Load Balancing sends the query to your server’s default home page, irrespective of whether the default page is named default.html, index.html, or any other different name. You should also consider creating a special file that responds only to the health check, when you are deploying your application. This will help in differentiating between traffic hitting your site, and traffic hitting other responses to the load balancer.
- Now, you need to set the “Healthy Threshold” value to 2. Leave the other Advanced Options set to their default values.
- Click on the “Continue” button.
The “ADD INSTANCES” page of the “Create a New Load Balancer” wizard will now open up.
3) Now, you will need to add Amazon EC2 instances. To do so:
- Click “Continue” on the “ADD EC2 INSTANCES” page of the “Create a New Load Balancer” wizard. The “REVIEW” page of the “Create a New Load Balancer” wizard will open up.
- You should now review all your settings, and make necessary changes, if any, by clicking on the edit link of any specific step in the process.
Important Note: After creating a load balancer, you have the ability to modify any of the settings, except for Load Balancer Name and Port Configuration. You will need to create a replacement load balancer if you want to rename a lord balancer and/or change its port configuration.
Upon clicking the “Create” button, a confirmation window will open up.
- Click “Close”.
4) You will now have to add an Availability Zone. To do so:
- Click on “MyLB” from the “Load Balancers” pane.
- Click on the “Instances” tab.
- Click on the +/- icon.
Now, you will see the “Add and Remove Availability Zones” dialog box appear.
- Click on the “us-east-1b: 0 instances” option in the “Add and Remove Availability Zones” dialog box.
- Click on the “us-east-1c: 0 instances” option also.
- Click on the “Save” button.
You will see that the “Availability Zones” column for the load balancer has been updated for both Availability Zones.