Elastic Load Balancer in AWS
In Simplest terms, cloud computing means storing and accessing the data and programs on remote servers that are hosted on the internet instead of the computer’s hard drive or local server. It is also referred to as Internet-based computing.
Features of cloud
- No up-front investment
- Lowering operating cost
- Highly scalable
- Easy access
- Reducing business risks and maintenance expenses
Amazon Web Services
Amazon Web Services is a subsidiary of Amazon.com that provides on-demand cloud computing platforms to individuals, companies, and governments, on a paid subscription basis.
Elastic load balancer
Elastic load balancer is a service provided by Amazon in which the incoming traffic is efficiently distributed across a group of backend servers in a manner that increases speed and performance.
Let’s suppose the GeeksforGeeks website is deployed on an EC2 instance which gets limited traffic in common days and hence only limited servers are allocated to the application.
While during contests this website may go down due to a large amount of incoming traffic. A solution is needed to handle both the conditions efficiently.
The solution to this problem is Elastic Load Balancer !! It automatically scales up your resource and balances the load which is sufficient enough to handle the large incoming traffic.
Types of load balancer
Classic Load Balancer
It is the traditional form of load balancer which was used initially. It distributes the traffic among the instances and is not intelligent enough to support host-based routing or path-based routing. It ends up reducing efficiency and performance in certain situations. It is operated on connection level as well as request level.
Application Load Balancer
This type of Load Balancer is used when decisions are to be made related to HTTP and HTTPS traffic routing. It supports path-based routing and host-based routing. This load balancer works at the Application layer of the OSI Model.
Network Load Balancer
This type of load balancer works at the transport layer of the OSI model. It’s capable of handling millions of requests per second. It is mainly used for load balancing TCP traffic.
Steps to configure an Application load balancer in AWS:
Step 1: Launch the two instances on AWS management console named InstanceA and InstanceB. Go to services and select load balancer
Step 2: Click on create load balancer
Step 3: Select Application Load Balancer and click on create.
Step 4: Here you are required to configure the load balancer. Write the name of the load balancer. Choose the scheme as internet facing.
Step 5: Add at least 2 availability zones. Select us-east-1a and us-east-1b
Step 6: We don’t need to do anything here. Click on Next: Configure Security Groups
Step 7: Select the default security group. Click on Next: Configure Routing
Step 8: Choose the name of the target-group to be my-target-group. Click on Next: Register Targets
Step 9: Choose the instanceA and instanceB and click on Add to registered. Click on Next : Review.
Step 10: Review all the configurations and click on create
Step 11: Congratulations!! You have successfully created load balancer. Click on close.
Step 12: This highlighted part is the DNS name which when copied in the URL will host the application and will distribute the incoming traffic efficiently between the two instances.
Step 13: This is the listener port 80 which listens to all the incoming requests
Step 14: This is the target group that we created
Step 15: Now we need to delete the instance. Go to Actions -> Click on Delete.
Step 16: Also don’t forget to terminate the instances.