AWS load balancer and maintenance page

后端 未结 4 1706
隐瞒了意图╮
隐瞒了意图╮ 2021-02-07 06:21

I\'m using AWS Load Balancer with 3 EC2 servers, and I\'m trying to serve a Maintenance page when site is under maintenance.

This page need to return 503 HTTP code, bec

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-07 06:55

    The load balancer will serve a 503 for you when you no longer have any healthy server behind it so you should not do anything special.

    If you return anything but a 200 on the health check, ELB will take the machine out of the load balancer after it fails the configured number of health checks.

    So to recap, you can potentially serve 503 from your app when in maintenance, but you have to return 200 for health checks all the time. If you don't care about the content of the page, you can simply remove the machines from the load balancer (or fail health checks) and the LB will do the right thing for you.

提交回复
热议问题