1

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?

Kunal
  • 1,440
  • 4
  • 14
  • 37
  • How exactly did you setup this? – Marcin Nov 05 '21 at 09:40
  • @Marcin 1) 2 ec2 instances in 2 separate target groups 2) The ELB listens to port 80 (http) and redirects traffic to port 443 (https) 3) The 2nd listener points to the 2 target groups, 1st with a weight of 100 and 2nd one has a weight of 0 4) But if I shut down apache on the first ec2 it doesn't redirect to the 2nd target group and shows bad gateway – Kunal Nov 05 '21 at 12:28

1 Answers1

2

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.

Parsifal
  • 3,928
  • 5
  • 9