AppRunner request timeout / HTTP 503


I've been successfully using App Runner to deploy a containerised microservice focused around uploading large files. The Docker container hosts a Gunicorn instance with a Flask web app.

I've that for larger file uploads (which naturally take longer), App Runner will answer with an HTTP 503 response. This happens after 30 seconds so I'm assuming there is a built-in request timeout enforced by App Runner, probably by the SSL-terminating proxy or load balancer.

Unfortunately, the App Runner documentation does not mention anything regarding request timeouts or maximum body sizes, so I can only guess. Before I change the upload to use a different mechanism (probably chunked upload), or move to a service with more control (Fargate?), I'd like to first confirm my suspicion. Also perhaps there is an undocumented way to work around this problem.

And yes, I increased the timeout of the application's HTTP server (gunicorn) to 600 seconds and also tested it locally, so there is definitely something inside App Runner causing this behavior.

Any help and/or pointers are greatly appreciated.

asked 2 years ago1554 views
2 Answers
Accepted Answer

According to AWS support, this is a known limitation of App Runner (requests running longer than 30 seconds result in HTTP 503), and is scheduled to be addressed in a future update. No ETA given unfortunately.

answered 2 years ago
  • Is this documented somewhere?

  • The timeout per request is currently 120 sec.


I don't think we cut hard the connectivity but we do throttle the CPU down when there is no active requests to the instance. See this thread.

answered 2 years ago
  • How/where do you issue the curl command? Do you schedule it from the outside?

  • Hi. I issue the curl command from outside, from a normal internet-connected host, outside of AWS. For me this strongly feels like a 30 second timeout enforced by either load balancer or envoy proxy.

  • I investigated this further and added a route in the micro service that just sleeps for a specified amount of seconds and then returns an HTTP 200 response, to eliminate any other factors in the application.

    $ curl -v https://.../sleep?seconds=31

    GET /sleep?seconds=31 HTTP/1.1 Host: <redcated> User-Agent: curl/7.64.1 Accept: /

    < HTTP/1.1 503 Service Unavailable < content-length: 95 < content-type: text/plain < date: Wed, 29 Dec 2021 13:19:47 GMT < server: envoy < connection: close

    Sleeping for a shorter time (e.g. 29 seconds or less) works fine.

  • I will try approaching AWS support with this. Thanks for the pointer though!

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