Saturday, August 25, 2018

Creating an Elastic load balancer in AWS


Elastic load balancing service allows to distribute traffic across a group of amazon EC2 instances in one or more availability zones which help us to achieve high availability  in applications























  • Elastic Load Balancing automatically distributes incoming application traffic across multiple Amazon EC2 instances.


  • Elastic Load Balancing supports routing and load balancing of Hypertext Transfer Protocol (HTTP), Hypertext Transfer Protocol Secure (HTTPS), Transmission Control Protocol (TCP), and Secure Sockets Layer (SSL) traffic to Amazon EC2 instances.

Elastic load balances are 2 types Application load balancers and network load balancers ( there is one more type called classic load balancers which is treated as a previous generation by amazon, the main difference of application and network load balancers is the first one works at layer 7 in OSI model where the second one works at layer 4

Application Load  balancers

  • Uses Layer 7 in OSI model and can load balance http/https requests 
  • ALB supports https protocol and this help us to manage SSL certificates through AWS idendity management service (IAM) and certificate management service 
  • Uses SNI ( Server Name Indication) which is an extension of the TLS protocol which a client indicates hostname to connect to the start of the TLS handshake.This also supports smart certificate option where the certificate manager checks the hostname of the client with multiple  certificates and select the best one
  • We can load balance any application hosted in AWS or any other on premises using ipaddress of tha application backends as targets 
  • Application load balance requires to specify more than one availability zone which improves the high availability . 

Network Load balancing 

  • Connection based load balancing where you can route traffic to multiple services using TCP protocol 
  • Used to have high availability with in same availability zone . This offers traffic to only healthy targets and will cut the traffic if they found any target is unhealthy
  • Network load balancing is using where we need low latency and high throughput 
  • It supports static ip addresses which will be used in front end of the load balancer for the applications 
  • It also supports elastic IP per availability zone
I am providing the steps here to configure network load balancer in AWS 


1. First let's have two instances ready which can be used as targets for ELB





2. Login to the instances and make sure httpd service is running and have the index.html is configured inside the /var/www/html







3. Now select the load balancer option from resources and we can see the different ELB options as below













4. Provide the ELB name and select the option as internet facing from the configure loadbalancer tab ( also select the Listerners as TCP 80)














5. Select the availability zone as below  ( you can configure different availability zone as per the region )









6. Create the target group in configure routing tab as below










7. Also configure the health check details of the targets as below








8. Register the targets which are the EC2 instances configured earlier as below











9. Review the settings and create the load balancer






















10. If we copy and paste the DNS name url of the load balancer which is given in the details of the ELB configuration in browser we can see the message ( the message configured in index.html)



11. To test the functionality let us stop the httpd process and make the target as unhealthy weshould get the response from other node without any interception
























A sample configuration of the Elastic load balancing is ready in your setup

Thank you for reading ..

2 comments: