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.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン