Search code examples
amazon-s3amazon-cloudfront

What is the difference between caching pages on S3 versus CloudFront


What is the difference between caching pages on S3 versus CloudFront ?

I'm currently using Cloudfront to cache pages previously generated by by (Tomcat server on EB) server and also images referenced in those pages, but for some reason CloudFront doesnt always seem to use the cache.

Page generation requires a number of webservice calls to another service and is computationally intensive but once a page is created it does not change for at a least a month. This why I want additional requests for the same page to use the CloudFront cache but failing that I thought that once the server creates a page it could store it on S3, and then if it received the same request again it could check S3 and if it existed serve it from S3. This would remove the redoing the webservice and computations.


Solution

  • The biggest difference is CloudFront is in more than 50 locations worldwide, so it will deliver content faster to viewers worldwide.

    Actually, you don't have to choose - you can generate pages, put them to S3 for maximum cacheability, and then deliver through CloudFront for best viewer experience.