AWS Certified Solutions Architect - Professional 2020

Sign Up Free or Log In to participate!

Dynamic Content With CloudFront

In CHAPTER 6.6, Scott says "dynamic content delivery is achieved using HTTP cookies forwarded from your origin"… So, is this the final "result" when I set, for example, S3 objects with a TTL=0 header? Is this the result of a "no-cache" configuration on CloudFront itself? I understand both are valid options, besides choosing to "Forward all cookies to your origin". But notice that Scotts says "FROM" origin, and not "TO" origin. I am a bit confused here… Any guidance? In short, how can I configure CloudFront to serve dynamic content (for instance, from API Gateway) – alternatives and pros/cons.

1 Answers

Hi Franca,

Dynamic content would be like webpages that were generated by PHP, ASP or a Java process for example…. The URL may be the same, but the page content would be different. I can’t think of an example where you’d have dynamic content coming from an S3 bucket because there’s no server-side processes to render a page dynamically.

Also, for what it’s worth, API Gateway already uses CloudFront behind the scenes so no real need to create a Cloudfront distro in front of an API Gateway deployment for performance reasons.  You could use WAF and CloudFront though for extra DDOS protection I suppose.



Hey, Scott, thanks for your answer, but I think you missed my question. I understand the concept of dynamic content and, in fact, it could come, indeed, from S3 as an output repository from a process, e.g., a SPA deploy pipeline saving a new index.html which I don’t want to cache at all. But that’s the point: in this (SPA) case, I change the S3 object metadata informing CloudFront I do not want cache. I would like to know (maybe a Ref.) how a "client cookie" could have the same result on CloudFront cache…

Scott Pletcher

You should be able to find this in the AWS documentation. I found this with a Google search:

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?