ALB - nginx proxy_next_upstream functionality

0

nginx has a feature called proxy_next_upstream where it will retry a request against another upstream if an error occurs on the 1st upstream it tries, such as an error, timeout, or certain http code:

https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream

Does similar functionality exist in an ALB where it retries a request against another target if the 1st target fails?

In my example, I have 2 EC2 webservers behind an ALB, and if I reboot one of them or it has another issue, could the ALB immediately start redirecting traffic to the other EC2? I have the Health Check at 5 seconds, but hoping to avoid the downtime waiting for the Health Checks to fail.

Or is there another way to avoid downtime in a scenario like this?

Thank you for your help.

rbro
asked 7 months ago652 views
1 Answer
0

If you need to reboot an EC2, remove it from the target group before you reboot it so that the connections are drained and you don’t have the issue waiting for the health checks to time out.

After the reboot add it back in.

You can do this automatically such as when patching using SSM lifecycle.

profile picture
EXPERT
answered 7 months ago
profile picture
EXPERT
reviewed 7 months ago
  • Thanks, I will check into removing the EC2 from the target group for reboots. Are there any options for unplanned outages such as if the webserver stops responding? I see the minimum HealthCheckIntervalSeconds is 5 and UnhealthyThresholdCount is 2, so I believe that means there will be at most 10 seconds of downtime where end users will get http 502 errors trying to access my website. Is there any way to have a faster failover since I already have a 2nd (or 3rd or more) webserver in the load balancer?

    I suppose I could write my own script to check the webserver health on a faster interval and remove it from the target group myself, but curious if there was a better way.

    Thanks again for your help.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions