Back to results for “Monitoring (CloudWatch)”
AWS › Amazon API Gateway

How can you cache responses in API Gateway to improve performance?

Intermediate

Answer

API Gateway provides a built in caching layer that stores responses from your backend for a configurable time to live period, so repeated requests for the same data can be served directly from the cache instead of hitting your backend service again, which reduces latency and backend load significantly.
aws apigateway update-stage --rest-api-id abc123 --stage-name prod --patch-operations op=replace,path=/cacheClusterEnabled,value=true
Real-world example A weather application caches its API Gateway responses for five minutes, since weather data does not change every second, dramatically reducing the number of calls made to the backend Lambda function.

Common follow-ups: How do you invalidate the API Gateway cache manually?;What cache sizes are available for API Gateway?