Cache Behaviors and TTLs

~10 min read

How CloudFront decides what to cache, for how long, and what makes two requests 'the same' for caching purposes.

Cache Behaviors and TTLs is a Pro topic

Sign in, then upgrade to Pro or Power to unlock this topic and the full AWS curriculum.

Key points

  • Cache behaviors are matched by URL path pattern, most specific pattern wins
  • The cache key determines what counts as 'the same request' — by default excludes query strings/headers/cookies
  • TTLs can be set explicitly in CloudFront or driven by the origin's Cache-Control/Expires headers
  • Including unnecessary elements in the cache key fragments the cache and hurts hit rate