Creating a Load Balancer
Now, my instance is running, and its IP address is 18.104.22.168.
The above screen shows that the server has been installed successfully.
Load Balancer name: It is the name of the Load balancer that the user provides. Suppose I have given a ClassicELB as a load balancer name.
Create LB inside: I kept it as a default VPC.
Create an internal load balancer: As we want to serve external web traffic, so we need an external load balancer, not an internal load balancer. Uncheck this field.
Enable advanced VPC configuration: Check this field to add at least one subnet.
Linear Configuration: It describes from which protocol and port, it is listening, and to which port it is passing.
Ping Protocol: It defines the type of protocol.
Ping port: It defines the port number.
Ping Path: It defines the path of the web page that we created, i.e., healthcheck.html.
Response Timeout: It defines how long it will take and waits for the response.
Interval: It is the amount of time between health checks.
Unhealthy threshold: It defines the number of consecutive health check failures before declaring an EC2 instance unhealthy.
Healthy threshold: It defines the number of consecutive health check successes before declaring an EC2 instance healthy.
The above screen shows that Class load balancer has been successfully created.
Therefore, we can say that DNS name is converted into a public IP address which is directing you to the index.html. Amazon provides DNS name to the Classic Load Balancer rather than a public IP address as the public IP address can be changed.
Note: Once the EC2 instance is out of service, the load balancer would not send the traffic to EC2 instance as it is presuming that healthcheck file that we created has been failed.