Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between elb health check and ec2 health check?

Tags:

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?

like image 831
Ben Avatar asked Feb 26 '17 08:02

Ben


People also ask

What is EC2 health check and ELB health check?

The ELB Health Check is configured with a protocol and port number to call on the target instances. A healthy EC2 instance is one that issues a response to a health check call with a 200 response code.

What is an EC2 health check?

Instance status checks monitor the software and network configuration of your individual instance. Amazon EC2 checks the health of the instance by sending an address resolution protocol (ARP) request to the network interface (NIC). These checks detect problems that require your involvement to repair.

What is ELB health check?

ELB health checks measure the network availability of EC2 instances across the Amazon Cloud. The load balancers will query different instances to check if they are still considered healthy. Instances that are working correctly will respond with a code of 200 within the default amount of time which is 30 seconds.

What happens if an EC2 fails health check?

If an instance fails these status checks, it is marked unhealthy and is terminated while Amazon EC2 Auto Scaling launches a new replacement instance. You can attach one or more load balancer target groups, one or more Classic Load Balancers, or both to your Auto Scaling group.


1 Answers

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

like image 75
Sergey Kovalev Avatar answered Sep 21 '22 08:09

Sergey Kovalev