AWS Download and Service Platform

I am using AWS Load Balancer with 3 EC2 servers and I am trying to maintain the maintenance page when the site is under maintenance.

This page should return 503 HTTP code because it is the correct code for maintenance mode and will prevent possible SEO problems.

When I return the 503 code from any of my servers, the Load Balancer makes it "Not In Service", and when all the servers return 503, the website returns a blank page (since all servers are disconnected).

My questions:

1) Is there a way to serve a custom static page with a message for visitors from load balancing if there are no healthy servers?

2) Or how to configure Load Balancer Health Make sure that it will not consider 503 as a reason for marking the server as "unhealthy"?

Thanks!

+7
amazon-web-services amazon-ec2 load-balancing maintenance-mode
source share
3 answers

You can implement an additional route on your application server, say / hcm (to service the health check), which always answers 200 OK. When this is the time for maintenance, you programmatically change the ELB health check to use the / hcm target, which returns 200 OK, and not / or / index.html, which returns 503 Service Unavailable. Discard these changes when you exit service.

+9
source share

It may not meet your 503 requirements, but a good option for this is to fail s3 and dns: https://aws.amazon.com/blogs/aws/create-a-backup-website-using-route-53-dns-failover -and-s3-website-hosting /

+3
source share

a load balancer will be server 503 for you when you no longer have a healthy server, so you should not do anything special.

if you return anything other than 200 for a health check, ELB will exit the machine from the load balancer after it does not complete the configured number of health checks.

therefore, to remind you, you can potentially serve 503 from your application during maintenance, but you must return 200 to check for health all the time. If you do not care about the contents of the page, you can simply remove the machines from the load balancer (or not check the functionality), and LB will do everything right for you.

0
source share

All Articles