Issue
I'm a little confused about Elastic Load Balancer health check and Amazon EC2 health check.
In Adding Health Checks to Your Auto Scaling Group it says:
If you have attached one or more load balancers to your Auto Scaling group and an instance fails the load balancer health checks, Auto Scaling does not replace the instance by default.
If you enable load balancer health checks and an instance fails the health checks, Auto Scaling considers the instance unhealthy and replaces it.
So if I don't enable the ELB health checks, EC2 health checks will work and if some instance fail health checks auto scaling will consider unhealthy instance and replaces it, and if I enable ELB health checks, the same thing will happen. So what's the difference between ELB health checks and EC2 health checks?
Solution
EC2 health check watches for instance availability from hypervisor and networking point of view. For example, in case of a hardware problem, the check will fail. Also, if an instance was misconfigured and doesn't respond to network requests, it will be marked as faulty.
ELB health check verifies that a specified TCP port on an instance is accepting connections OR a specified web page returns 2xx code. Thus ELB health checks are a little bit smarter and verify that actual app works instead of verifying that just an instance works.
That being said there is a third check type: custom health check. If your application can't be checked by simple HTTP request and requires advanced test logic, you can implement a custom check in your code and set instance health though API: Health Checks for Auto Scaling Instances
Answered By - Sergey Kovalev