API Gateway Max Cached Response Size

0

I am testing API Gateway cache behavior for an API with Lambda integration. The documentation clearly states (here and here) that "The maximum size of a response that can be cached is 1048576 bytes," in other words just over 1 MB. I am testing by adding a header to the Lambda response containing a timestamp--if the timestamp remains the same across requests, this would indicate that the response was retrieved from the cache and the Lambda was not invoked.

The problem I'm encountering is that during testing, the API cache behavior does not seem to align with the documented response size limits--it seems to be caching responses that are over 5 MB in size. Am I misunderstanding this limit, or can anyone shed any light on what is going on here?

1 個回答
0

Hi, @jeffgardnerdev.

I think your guess is correct. very interesting.

The document below also states that the capacity varies depending on the cache instance.
Can you measure what your current maximum cache size is?

https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cache-capacity/?nc1=h_ls

Are your API Gateway resources edge-optimized? Are you regional?
In the latter case, have you additionally introduced CloudFront, etc.?
In that case, check the access log of API Gateway and check whether it is cached by CloudFront.

profile picture
專家
iwasa
已回答 2 年前
  • @iwasa thanks for the response. I am testing with a regional API, no CloudFront, using the minimum cache size--0.5 GB. Cache is not encrypted and TTL is set to 3600. I have tested after clearing the cache and the results are consistent.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南