Introduction To AWS ELB - Part Two

In the previous article Introduction to AWS ELB – Part 1, we saw an introduction to ELB and also hosted a sample application on one of the EC2 instances. Here, in this article, we are going to learn and cover the below topics.
  • Types of Load Balancers.
  • Load Balancer Ports.
  • Vertical and Horizontal Scaling.
So, let’s get started.


Users cannot remember different/multiple endpoints or IP addresses of different servers running behind. They need one endpoint which they can hit and ultimately that endpoint will route and map the request to the appropriate server and that single endpoint can be created by load balancers.
We get a single endpoint with a load balancer and there are different types of load balancers available.
Hardware Load balancer
They are physical machines in datacenters. E.g.- F5, Cisco ACE, etc.
Software based Load balancer
For E.g.- Apache Http service, Nginx, HA Proxy, etc.
NGINX Plus and NGINX are used by many developers for load balancing solutions for high-traffic websites such as Dropbox, Netflix, and Zynga.
When you include NGINX Plus as a load balancer in front of your application and web server farms, it increases your website's efficiency, performance, and reliability.
To set up these types of load balancers with AWS, we need to launch AWS EC2 instances and then need to set up these services and then behind the scene it will route the request. For that, we will have to manage the instances on our own and need to install the OS as well.
So, suppose if we have only one NGINX, then it can receive the request and can route it to any of the tomcat app servers and will thus act as a software-based load balancer.
But with only one NGINX we have a single point of failure.

Cloud based Load balancer

In AWS we have AWS ELB, so instead of setting up a load balancer on your own, we can use ELB service.
We generally do load balancing on the PROD environment.
Classic Load Balancer provides basic load balancing across multiple Amazon EC2 instances.
Application Load Balancer is best suited for load balancing of HTTP and HTTPS, i.e., for web sites and they can also route the request to a particular path also. Like web01/images or web02/videos etc.
For example, goes to Gmail and goes to google images means request routing to another set of instances depending on the request.
Network Load Balancer is best suited for load balancing of Transmission Control Protocol (TCP), User Datagram Protocol (UDP) and Transport Layer Security (TLS) traffic where extreme performance is required.
We have 2 types of ports here,
Frontend Port
It Listens from the user requests on this port. E.g. 80,443,25 etc.
Backend Port
Services running on OS listens on this port. E.g.: 80,443,8080 etc.


So, by far in the previous article Introduction to AWS ELB – Part 1 we have set up one EC2 instance, but what if this instance goes down or CPU is full, or the site becomes inaccessible. So, to handle such kind of issues we do CLUSTERING.
Clustering is a grouping of similar services/apps/storage etc. and the main benefits are high availability and zero downtime and Scalability.
For example: Suppose normally our application has 1000 users and now for some sale or festival around 100000 users are expected, then the existing resources/instances cannot handle such heavy load. So, for this, we need to add more resources and we can do it by scaling either vertically or horizontally.
Vertical scaling means that you scale by adding more power (CPU, RAM) to an existing machine.

Vertical Scaling Examples

  • In case our laptop is running short of RAM then adding more RAM means vertical scaling.
  • Changing your instance from t2.micro to t2.large is an example of Vertical Scaling.
But there is always a limit to vertical scaling, we cannot scale vertically limitlessly as the systems where we are scaling vertically may have some limitations and it may also cause downtimes. 
Image source:
Horizontal scaling means that you scale by adding more machines into your pool of resources. Suppose we had 5 web servers and we add 2 more, this is horizontal scaling.


So, in this article, we saw different types of load balancers, their different ports, and different types of scaling. In the next article, we are going to practically see how we can do clustering and other interesting stuff.
I hope you find this article helpful. Stay tuned for more … Cheers!!