AWS ELB (Elastic Load Balancing) allows you to distribute the requests automatically to multiple instances that could be in different AZs. You can use it to manage your large auto-scaled environment. So by using it you can save your infrastructure from failing.
And for monitoring the same we can use the ELB – CloudWatch metrics. By default, ELB is enabled with detailed monitoring. But metrics only reported to CloudWatch when any request is going through the ELB.
Below are the monitoring metrics of AWS ELB.
Request Count: This is a total number of requests which are received by the load balancer and routed back to instances. So by monitoring this we can easily get to know when we need to add more instance to our infra or when we need to have an auto-scaled infrastructure.
HealthyHostCount/UnHealthyHostCount : The count of healthy/unhealthy instance, in each AZ. UnHealthyHostCount metric trigger when an instance have failed more health checks than the given threshold. The Instance can be unhealthy if there is some connectivity issue, Instance health check is giving non-200 response or time-out when performing the health check.
Latency: This tells you that how is your backend application performing. This measures how much time your application is taking to process a request. So if you see a high latency graph that means there is some performance problem in the application.
Backend Connection Errors: The number of failed connection when trying to connect to instance behind the load balancer.
Surge Queue Length: This is the number of requests which are queued up on load balancer that are waiting for registered instance to accept the connection. By monitoring this you can easily get to know when you need to have more servers in your pool.
Spillovers: This is the count of rejected requests because of surge queue is full.
HTTPCode_ELB_4XX : This is the count of HTTP 4XX error codes which ELB receives from the client.
HTTPCode_ELB_5XX : This is the count of HTTP 5XX (server error) which ELB receives from the client. There are few scenarios where ELB can also generate 5XX error if no instance is registered, the instance is unhealthy, or the request rate is higher than the ELB’s current capacity.
HTTPCode_Backend_2XX/3XX/4XX/5XX : These are the HTTP response codes which are generated by the back end instances.