Search code examples
amazon-web-servicesamazon-ec2aws-api-gateway

AWS HTTP API Gateway 503 Service Unavailable


I have an HTTP API Gateway with a HTTP Integration backend server on EC2. The API has lots of queries during the day and looking at the logs i realized that the API is returning sometimes a 503 HTTP Code with a body:

{ "message": "Service Unavailable" }

When i found out this, i tried the API and running the HTTP requests many times on Postman, when i try twenty times i get at least one 503.

I then thought that the HTTP Integration Server was busy but the server is not loaded and i tried going directly to the HTTP Integration Server and i get 200 responses all the times.

The timeout parameter is set to 30000ms and the endpoint average response time is 200ms so timeout is not a problem. Also the HTTP 503 is not after 30 seconds of the request but instantly.

Can anyone help me?

Thanks


Solution

  • I solved this issue by editing the keep-alive connection parameters of my internal integration server. The AWS API Gateway needs the keep alive parameters on a standard configuration, so I started tweaking my NGINX server parameters until I solved the issue.