Failed health check, what should I do?


My instance was giving a 504 error.

To my knowledge, nothing was updated about the site. My IP is

I spun up a new instance from a previous snapshot at but am getting a network connection error.

I also attached a classical load balancer and now am getting that the health check failed. What are the next steps?

3 Answers


I'm sorry to hear that you're experiencing issues with your instance. Here are some steps you can take to troubleshoot and resolve the issues you mentioned:

1. 504 Error: A 504 error typically indicates a gateway timeout. This could be caused by issues with your application, web server, or backend servers. To identify the root cause, check your instance logs and metrics.

  • Investigate logs: Check your server logs (e.g., Nginx or Apache) for any errors or unusual behavior that could help pinpoint the issue. This might help you find the root cause of the issue.

  • Check server resources: Ensure that your server has enough resources (CPU, memory, disk space) to handle incoming requests. If the resources are maxed out, you may need to upgrade your server or optimize your application.

  • Verify backend services: If your application relies on any external services, check their status and make sure they're working correctly.

      Relevant links:
  1. Troubleshooting 504 errors:
  1. Checking logs on EC2 instance:

2. Network connection error: A network connection error could be caused by several factors such as security group settings, VPC configurations, or routing issues.

  • Check security groups: Verify that your security groups are configured correctly to allow incoming and outgoing traffic on the required ports (e.g., HTTP: 80, HTTPS: 443).

  • Check VPC settings: Ensure that your VPC and subnets are properly configured, and the instance is associated with the correct VPC.

  • Verify routing tables: Ensure that your routing tables are correctly set up to route traffic between your instances and the internet.

      Relevant Links:
  1. Working with Security Groups

3. Health check failed on the Load Balancer: Health check failures typically occur when the instances behind the load balancer do not respond correctly to the health check requests sent by the load balancer.

  • Review health check settings: Check the health check settings on your load balancer, and make sure they're correctly configured (e.g., correct protocol, port, and path).

  • Verify backend server responses: Ensure that your backend servers are responding to health check requests with the expected HTTP status codes (e.g., 200 OK).

  • Check instance availability: Make sure your instances are running, and their status is "InService" in the load balancer console.

      Relevant links:
  1. Configure health checks

4. General troubleshooting

  • If the issue persists, follow the general troubleshooting steps in the AWS documentation. Relevant links:
  1. Troubleshoot EC2 Instances:
  1. Troubleshooting Classic Load Balancers:

By following these troubleshooting steps, you should be able to identify and resolve the issues you're experiencing.

In case my answer doesn’t address your question or if you have any follow up questions, please let me know.


profile pictureAWS
answered a year ago

Hello, HTTP 504: Gateway timeout indicates that the load balancer closed a connection because a request did not complete within the idle timeout period. Kindly refer the below links for troubleshooting.

answered a year ago

If you're connecting directly to your instance (rather than through a load balancer) and you're getting 5xx error message then the network connectivity is all ok. The error message is being generated by your web server software (whatever that is - Apache, IIS) and telling you there is some internal error. It's something on the instance that is going wrong here.

Putting a load balancer in front of the instance won't change that - and it will cause the problem you're seeing which is that health checks fail. The load balancer is expecting to see HTTP 200 (an "ok" code) from the website. It's seeing 504 so the health check will fail.

profile pictureAWS
answered a year ago

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