Amazon ELB – Setting Up ELB Health Checks with Multiple Applications on EC2 Instances

amazon-elbamazon-web-serviceshealthcheck

At AWS we'd like to to use ELBs to load balance EC2 instances which host multiple applications. Ideally we'd like to have a health check for application.

However, AWS Elastic Load Balancers currently only allow you to ping one location for a health check.

What would be the best way of implementing a health checks with ELB that takes into account the state of multiple applications deployed on each EC2 instance?

Best Answer

Here are two ways to solve this;

First option is to add another health check on the host that validates the health and returns HTTP 200s to the ELB if the logic says that you want to keep the host online. The logic there is, of course, up to you. The disadvantage here would be that if App 2 deployed successfully on some hosts all hosts would still be 'healthy' and receiving traffic.

Another option is to use an additional ELB for each application. You can point several ELBs to the same backend EC2 instances and the cost is pretty minor to do so. That way you can health check per application and drop hosts with issues at a per-application level rather than an all-or-nothing approach.

Edit: Please note this is an older answer and is specific to ELB not ALB. ALB supports separate targets on one host natively.