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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인