Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

aws load balancer with no health check? or make it work with non-200 response?

I have a site I am trying to attach to a load balancer that requires Basic Authentication. It fails the health check. I'm guessing this is because instead of returning a 200 it's returning a 401.

Similarly, I have another site that is trying to do a redirect. So instead of returning a 200 it's returning a 302. And again, this is treated as a failure by the health check. (Why do I want to have a load balancer in front of something that just redirects? Because of goofy client requirements, that's why!)

I don't see any way to just disable the health check, or to tell the health checker to accept a response other than a 200, or to tell it to supply authentication credentials, or ... any way around either of these problems.

like image 482
Jay Avatar asked May 28 '14 20:05

Jay


People also ask

How do I disable ELB health check?

You can't disable or suspend it but you can change the path OR the timeout and interval.

What happens when ELB health check fails?

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.

What ELB will do if one of the instances fails health check?

Health check failed The instance will continue being monitored and if it starts failing health checks, the ELB will respond by marking it as unhealthy, stop routing traffic to it, and wait for the ASG to replace it.

What happens when instance fails to pass health checks?

Your web application front end consists of multiple EC2 instances behind an Elastic Load Balancer. You configured ELB to perform health checks on these EC2 instances, if an instance fails to pass health checks, which statement will be true? The instance gets quarantined by the ELB for root cause analysis.


Video Answer


2 Answers

Two alternatives:

  • Configure a specific url for the health check, one that only sends non-200 responses when the service is really having problems (e.b. no database connection).

  • Change the Ping Protocol to TCP in the ELB configuration. That way it will only check for a sucessful tcp connection and not perform an http request.

like image 72
Julio Faerman Avatar answered Sep 19 '22 15:09

Julio Faerman


If anyone else comes across this, you can now set a list of valid response codes in the load balancer health check settings. I added 302 and get a success reply now.

like image 41
Si-N Avatar answered Sep 20 '22 15:09

Si-N