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?

| |
  • 1
    Suspect you'd have to use a lambda to detect the state and update the target group. – Tim Sep 24 '19 at 23:21
  • how would that work? How would the lambda get notified of the change? – MrCholo Sep 25 '19 at 6:52

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

| |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.