Load Balancer:
Table of Contents
- Health Check of LoadBalancer Setup in AWS EC2 Machine. Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers, also known as a server farm or server pool.
- In this manner, a load balancer performs the following functions: Distributes client requests or network load efficiently across multiple servers.
- Enable the Load Balancer Based on Health Check
Types of Load Balancer:
- Application Load Balancers.
- Network Load Balancers.
- Classic Load Balancers.
- Amazon ECS services can use either type of load balancer.
- Application Load Balancers are used to route HTTP/HTTPS
What is health check?
- Load Balancer periodically sends a request to its registered instance to test their status these tests are called health check.
- The Load Balancer routes request only to the healthy instance.
- When the load balancer determines that an instance is unhealthy, it stops routing requests to that instance.
How to create Load Balancer?
- Login to AWS Root user.
- In the AWS management console go to “services”.
- Go to “EC2”.
- In the EC2 dashboard go to “Load Balancer”.
- Click on “Create Load Balancer”.
- As we learn before we have three types of load balancer, Application Load Balancer, Network Load Balancer, Classic Load Balancer.
- Application Load Balancer, Network Load Balancer these balancers need to pay for use.
- But for your learning porpoise, we go with “Classic Load Balancer”.
- In Classic Load Balancer click on “Create”.
- Give the load balancer name.
- Create LB Instance leave it as default.
- VPC configuration, Internal LB lives it unchosen because they will charge.
- Load Balancer Protocol gives as HTTP.
- Click on “Next”.
- Assign Security Group to load balancer.
- If you want to create a new security group can select create a group.
- If you want to select from the existing group you can select.
- Click on “Next”.
Health Check Setup
- Health check which your load balancer will automatically perform health checks on your EC2 instances and only route traffic to instances that pass the health check.
- If an instance fails the health check, it is automatically removed from the load balancer. Customize the health check to meet your specific needs.
- The Ping protocol as “HTTP”.
- Ping port “80”.
- Ping path “/healthy.html”.
- In Advanced Details give “Response Timeout”, which is used to set time to the website response.
- Add “Interval time”, which is used to set time to the website to reload.
- Give “Unhealthy threshold”, which checks the instance 2 times and the instance is not responding it is not healthy.
- Give “Healthy threshold”, which checks the instance 3 times by refreshing it if it gives an instance response it is healthy.
- Click on “Next”.
- Select EC2 instance if you have or otherwise we can add it later.
- Click on “Next”.
- Give the tag to the LB.
- Click on “Review and Create”.
- Review the details which you have given.
- Click on “Create”.
- The status bar shows 0 of 2 which means there is no instance is running.
- If it shows 2 of 2 it means the instance is in service.
- Let’s check whether the DNS name is working or not.
- Copy it and open in new tab.
- When you reload the page, it will send load to another EC2 instance, it will balance each time when you reload the page.
- So this is how Health Check of LoadBalancer Setup in AWS EC2 Machine
Pingback: Simple Queue Services Concept | Create SQS and Setup