Wednesday 14 June 2017

Creating an Elastic Load Balancer (ELB)

The Elastic Load Balencer is a PaaS load balencer available in AWS. Before configuring it let's briefly touch upon its characteristics.


  1. The ELB is a region wide load balancer. It's a Paas or fully managed service meaning that AWS is responsible for all the high availability/redundancy requirements for the ELB and it's made available to us as a service that we can use. 
  2. ELB can load balance across different availability zones within the same region. It can be used internally or externally i.e. we can use it to load balance instances that are internet facing as well as those instances which are isolated from the internet. So the load balancer can have an elastic IP address to make it publicly accessible over the internet or it may have a private IP address. 
  3. It has the capability to perform SSL termination and processing and take some load off of the instances.
  4. It provides a feature called cookie based sticky sessions. It allows a configuration wherein a user connecting to a particular instance via a browser is always connected to the same instance.
  5. It is tightly integrated with auto scaling. So if ELB pulls out a server from rotation then auto scaling can detect it and provision another instance.
  6. ELB also provides health checks and provides advanced health features. For example, we can check for a web page to load successfully on an instance. If the page does not load successfully a certain number of times within a stipulated time period then take the instance out from the load balecer. It also integrates with cloudwatch monitoring.



Now lets configure an ELB.

From the management console point to EC2 and under load baelcing select load balencers.


From here click on create load balencer.


Now we get to defining the load balencer. Specify a name for the ELB and select the VPC in which you want to create the ELB. If you do not want the load balencer to be internet facing then check mark 'create an internal load balencer'.
Next we get to listener configuration. The load balencer port/protocol specifies what the load balencer should be listening for when users try to connect to it. Here we can specify HTTP, HTTPS, SSL or a custom TCP port. If we specify SSL then we'll also have to provide a SSL certificate at one point during the configuration. The default is HTTP port 80. The instance protocol/port specifies where the load balencer will forward the received traffic. Next we specify the subnets for instances where the ELB will route traffic.




After making the required selections, click on next:Assign security groups.

Now we get to apply a security group to our ELB. We can create a new SG or apply an existing one like I've done here.



Next we get to configure our health check parameters.



The ping protocol and the ping port are what the ELB listens on from the instances to ascertain their health. The ping path is web page available on the instances which must be loaded successfully by the instance to confirm that it's healthy.
Let's go through the advanced details section now.
The response timeout defines how quickly the instance must respond before being deemed unhealthy.
The interval is the time interval between consecutive health checks.
Unhealthy threshold is the number of health checks the instance must fail before being taken out of rotation by the ELB.
The healthy threshold is the number of health checks the instance must respond to before being deemed healthy and brought back into rotation.

Next we add instances to our ELB. For the sake of testing I've added instances within the same availability zone and same subnet. But AWS best practices dictates that instances being added to an ELB should belong to different subnets and different availability zones.



Then we can add tags to our ELB. Tags basically help make AWS entities more identifiable when we go though resource usage in our bill.

Finally, we get a review screen where our settings for our ELB are displayed. if all is well click on create.


That is it. Our ELB will now be created and be visible in the ELB dashboard as shown below:


Notice that we are only shown the DNS name and not the IP address for the ELB. This is because the IP address will not remain constant throughout the life of the ELB.

3 comments:

Using capture groups in grep in Linux

Introduction Let me start by saying that this article isn't about capture groups in grep per se. What we are going to do here with gr...