Log In to start Learning

Login via

Post By Admin Last Updated At 2020-06-15
AWS Elastic Load Balancer

In the previous blocks, we have created various Instances in your account. And also we have created Elastic IP addresses. So if we share these IP addresses to the public, many people start accessing these machines. And we cannot say at what time, the people will be connecting to the machine. It means the traffic to these machines was variable.

While creating an instance, we people assume some traffic and allocate some resources to that instance. But in some cases, if the traffic is more than the expectation, then theses resources were not enough. So it means, we people need to allocate the resources on the basis of traffic. Since we cannot predict the traffic in advance, it is not possible to allocate the resources based on the requirement. But the AWS platform can do with Elastic Load balancer

What is an Elastic Load balancer?

The Elastic Load balancer refers to efficiently distributing the incoming network traffic across the group of back-end servers to increase the speed and performance. AWS has the ability to scale up (or) scale down the resource automatically to efficiently handle the large incoming traffic. The load balancer increases application availability. Besides, you can add/ remove the instances from the load balancer as per your requirement. In the load balancer, a listener checks the connection request from the client using the port and protocol that you configure.

Moreover, this platform allows adding one (or) more listeners to the load balancer. And you can add Besides, it forwards the request to one (or) more registered instances using the protocol and port number that you configure. Besides you can configure the health checks to monitor the health of the registered instances. By default, the load balancer distributes the traffic evenly across all the registered instances

Need for load Balancer:

Load balance's were primarily meant for making your resources highly available. Basically there are 4 types of forwarding rules that the user can assign to the load balancer. And these can be broken down as follows:

HTTP:

It is the standard request based on the HTTP mechanism. It directs the traffic to back-end information for the original request.

HTTPS:

It is the same as the HTTP forwarding rule with an additional encryption feature. It is capable of handling the encryption in two ways. i.e SSL pass through and SSL termination

UDP:

The UDP load balancer uses the user data gram protocol. And this provides a low latency to the applications

TCP:

TCP is meant for load balancing the applications that don't use the HTTP and HTTPS protocols

And this Elastic load balancer is divided into the following types

Classic Load Balancer:

This is the most basic form of the load balancer that was initially used for the classic EC2 Instances. And this can be operated both on the connection level as well as the request level. The main drawback of this load balancer is it does not support features like host-based routing as well as path-based routing. Once the load balancer is configured, it balances the load across the servers. In this load balancer, routing decisions can be taken in a transport layer (TCP/SSL) (or) the application layer (HTTP/ HTTPS). And currently, the classic load balancer requires the fixed connection between the load balancer port and container instance port.

 “AWS Elastic Load Balancer” is locked AWS Elastic Load Balancer1 
Application Load Balancer:

we prefer this type of load balancer where there are HTTP and HTTPS routing. This load balancer work at the OSI model application layer. Besides, it provides advanced routing features such as host-based and path-based routing. This balancer works well with containers and the micro-services. The application load balancers receive the route request and then inspects the received packets. It then chooses the best target for the load type and sends it to the target with the highest efficiency.

 “AWS Elastic Load Balancer” is locked AWS Elastic Load Balancer2
Network Load Balancer:

This load balancer works at the layer 4 of the OSI model. It is responsible for load balancing the TCP traffic. Besides, this load balancer supports the static (or) elastic IP. This load balancer can handle the traffic in terms of millions. And this load balancer suits best for maintaining low latencies. Besides maintaining the static IP address, it is capable of handling the uncertain traffic. It means, it handles millions of requests per second. And this works good at the connection level.

 “AWS Elastic Load Balancer” is locked AWS Elastic Load Balancer3 

Since we have got a brief idea of the load balancer, we will now create the load balancer practically. And in order to apply the load balancer, we need a minimum of two instances in your AWS Count.

Click on AWS Services to know about the instance creation

And I assume that you have a minimum of instances in your AWS Account. Hence follow the steps mentioned below to create the elastic Load balancer.

 

step - 1

Login to your AWS account and start your instances

AWS Elastic Load Balancer4 

step - 2 :

Navigate to load balances

AWS Elastic Load Balancer5 

step - 3:

Click on Create load balancer

AWS Elastic Load Balancer6 

step - 4 :

Select the load balancer. (In this case, I'm selecting Classic Load Balancer)

AWS Elastic Load Balancer7 

step - 5:

Provide the name and load balancer protocols and click on Next assign security groups

AWS Elastic Load Balancer8 

step - 6 :

select the security group and click on Configure security settings

AWS Elastic Load Balancer9 

step - 7 :

Click on Configure Health Check

AWS Elastic Load Balancer10 

step - 8:

Click on Add Ec2 Instances

 AWS Elastic Load Balancer11

step - 9 :

Select the instances that you need and click on Add tags

AWS Elastic Load Balancer12 

step - 10 :

Provide the key-value pair and click on Review and Create

AWS Elastic Load Balancer13 

step - 11:

 Click on Create

AWS Elastic Load Balancer14 

step - 12:

And finally, click on Close

AWS Elastic Load Balancer15 

step - 13:

Login to any one of the instances using the putty session. And give the following commands

AWS Elastic Load Balancer16AWS Elastic Load Balancer17AWS Elastic Load Balancer18AWS Elastic Load Balancer19AWS Elastic Load Balancer20AWS Elastic Load Balancer21

step - 14:

Once again go back to your load balancer, copy the DNS Name and paste it in the browser. Then you will see the text changing in the browser

And if you see the changes, then you are successful in creating the load balancer.

Advantages of AWS ELB:
  • Highly Available:

ELB distributes the traffic evenly among all the targets. for example multiple targets. These targets include Amazon EC2 instances. containers, IP addresses, Lambda function. Besides, it is also responsible for load balancing across the region, routing traffic to the healthy routes in different regions. And it has an SLA of 99.99%

  • Secure:

Elastic Load Balancer with Virtual private cloud to provide robust security features. This included the integrated certificate management, user authentication as well as the SSL/ TLS decryption. And these together provide the flexibility to centrally manage the TLS setting and the CPU intensive workload applications

  • Elastically scalable:

An elastic load balancer is capable of handling the rapid changes in the network traffic patterns. Besides deep integration with auto-scaling, it ensures sufficient application capacity. And this meets the varying levels of application loads without requiring manual intervention. Moreover, an elastic load balancer can handle the sudden spikes in the traffic and can handle the millions of requests per second. So whenever there is an increase in traffic, the auto-scaling feature will be automatically enabled.

  • Hybrid Load Balancing:

Elastic Load balancer offers the ability to load balance across the AWS and on-premises load balancer using the same load balancer. So it makes easy for you to migrate, brust (or) fail over on-premises applications to the cloud.

  • Flexible:

Elastic Load Balancer allows you to use IP addresses to route the request to the application targets. This offers the flexibility to visualizer the application targets. Besides, it allows you to host multiple applications on the same instance. Besides it also enables the application to have the individual security group and use the same network port.

Robust monitoring and auditing:

Elastic load balance allows you to monitor your applications and their performance in real-time. This includes the Amazon Cloud watch metrics, logging, and request tracking. Besides this improves visibility into the behavior of your applications, identifying the performance bottlenecks in your application stacks.