I'm struggling to get my AWS ELB Application Load Balancer working.
I am trying to set up a 100/0 weighting to 2 different target groups, production, and failover. Only when production goes down, traffic must route to failover, in all other cases, all traffic must go to production.
I have it set up, but when production goes down, it doesn't switch over, it just gives a 502.
Is it possible to send traffic to Production 100% of the time, and only to failover when it goes down, and then back to production if it goes back up again? The listener is 100 to prod and 0 to failover, but it never switches to failover.
Or this isn't possible with ELB?
CodePudding user response:
Target group weighting exists to support A/B testing, not to support failover.
Normally, you would configure your ALB with multiple targets in the same target group and then use a health check. However, this assumes that all servers can accept traffic all the time. And note that, if all servers in a target group become unavailable, the target group still receives traffic (search that link for "fails open").
If you really do need to switch to a separate set of servers only when the first goes down, then you need to use Route53 health checks with DNS failover. This means creating two ELBs.
Opinion: DNS failover is only useful to handle the case where an entire region goes down. Which means that you need to duplicate everything, and have a way to handle cross-region updates for any databases.