Setup an ALB to re-route to a different target group if all checks are failing

0

We are trying to put up a maintenance webpage for our customers, when our application is down for whatever reason.

Say we have an Application Load Balancer on AWS.

How do we setup an ALB to re-route to a different target group if all checks are failing? Say there are 2 target groups, one is the "primary" target group. And if all instances in that TG are unhealthy, is there a way to then route to a different target group, or a different URL or something?

MrCholo

Posted 2019-09-24T17:15:14.990

Reputation: 131

1Suspect you'd have to use a lambda to detect the state and update the target group. – Tim – 2019-09-24T23:21:22.770

how would that work? How would the lambda get notified of the change? – MrCholo – 2019-09-25T06:52:46.723

Answers

0

You could use AWS Lambda to monitor the ALB. If the healthy host count falls to zero you could trigger a lambda which changes the target group.

This blog post has a good outline on how to do something somewhat similar, though you'll have to extend it yourself. Basically Cloudwatch Events triggers lambda.

enter image description here

Tim

Posted 2019-09-24T17:15:14.990

Reputation: 529