Amazon API Gateway : Extending Timeout Limits Beyond 29 Seconds

Ravi Intodia
3 min readJun 23, 2024

--

As we all know Amazon API Gateway is a useful service that enables developers to create, publish, maintain, monitor, and secure APIs at any scale. Along with all the good things that Amazon API Gateway can do there is one common challenge faced by developers using Amazon API Gateway is the default timeout limit of 29 seconds for API requests. In situations where API operations require more time to process, developers may encounter timeouts. In this blog post, we will discuss how to extend the timeout limits in Amazon API Gateway beyond the default 29-second threshold.

FYI — This change has been recently launched by AWS in June 2024 and required a quota increase request / approval before it can be applied.

Understanding Timeout Limits in Amazon API Gateway :

Timeout settings in Amazon API Gateway determine how long the service will wait for a response from the integration endpoint before returning an error to the client. By default, the timeout limit for Amazon API Gateway is set to 29 seconds. This means that if an API request takes longer than 29 seconds to process, Amazon API Gateway will return a timeout error to the client.

Key Reasons for Extending Timeout Limits:

There are various scenarios where API operations may require more time to complete, such as processing large datasets, complex computations, or integrating with slow external services. In such cases, it becomes necessary to extend the timeout limits in Amazon API Gateway to prevent timeouts and ensure that API requests are successfully processed.

Steps to Increase Timeout Limits Beyond 29 Seconds:

Step 1 — Requesting a Service Quota Increase for Amazon API Gateway Response Timeout , follow below steps:

  • Go to the AWS Service Quotas console in the AWS Management Console.
  • In the navigation pane, choose “Amazon API Gateway” from the list of services.
  • Locate the specific quota related to Amazon API Gateway response timeout and click on it to view details.
  • If the current quota is lower than your desired timeout value, click on the “Request quota increase” button.
  • Provide the necessary information, such as the desired timeout value, use case, and any additional details to support your request.
  • Submit the request for the quota increase and await a response from AWS.
  • Smaller quota increase requests are auto-approved instantly and for higher quota increase AWS will review your request and notify you of the outcome. If the quota increase is approved, you will be able to set a higher timeout value for your API in Amazon API Gateway without hitting the service quota limit.

Step 2 -Now to increase the timeout limits beyond 29 seconds in Amazon API Gateway, follow below steps:

  1. Log in to the AWS Management Console and navigate to the Amazon API Gateway service.
  2. Select the Amazon API Gateway API for which you want to extend the timeout limit.
  3. In the Amazon API Gateway dashboard, go to the “Resources” section and click on the desired resource or method.
  4. Under the selected resource or method, click on the “Integration Request” or “Method Execution” settings.
  5. In the integration settings, find the “Integration Timeout” option and increase the timeout value to your desired limit (e.g., 60 seconds, 120 seconds, etc.).
  6. Save the changes and deploy the API to apply the new timeout settings.

Best Practices: When extending timeout limits in Amazon API Gateway, consider the following best practices:

  • Set timeout limits based on the expected processing time of API operations.
  • Monitor API performance regularly to identify any bottlenecks or issues related to timeout settings.
  • Implement appropriate error handling mechanisms to handle timeout errors gracefully.
  • Test API performance under different load conditions to ensure that the timeout settings are optimized.

Conclusion:

By extending the timeout limits beyond 29 seconds in Amazon API Gateway, developers can ensure that API requests requiring longer processing times are successfully completed without timeouts. By following the steps outlined in this blog post and adhering to best practices, developers can effectively manage timeout settings in Amazon API Gateway and optimize API performance.

--

--

Ravi Intodia
Ravi Intodia

Written by Ravi Intodia

Solution Architect working on designing and implementing AWS Cloud based solutions.

Responses (1)