If i plan on creating a static website (using a WCMS like Jahia, Wordpress etc) can i try and host the whole site via Cloudfront, using an approach something like below?
- Build the website in the WCMS and export the whole site structure
- Create an S3 static website bucket
- Use a tool such as S3_Website (on Git) to the exported website file into S3
- At any later time when need to synchronise updates to the exported website with the S3 website, run s3_website push again. (It will calculate the difference, update the changed files, upload the new files and delete the obsolete files.)
- Use some sort of polling process to run the export API and S3_website push script to auomate the whole process. Maybe a Lambda function. Run this say every night assuming a cache TTL of 24 hours?
- At any later time when need to synchronise updates to the exported website with the S3 website, run s3_website push again. (It will calculate the difference, update the changed files, upload the new files and delete the obsolete files.)
- Flush the content to the Cloudfront cache via a pre warm script (such as the armfront script on Git). I'm a bit unclear how this works in terms of it does a flush and replace or invalidate if this matched time wise (i.e. the content TTL expires just before we pre warm etc?). Do i even need to pre warm?/flush
- Cloudfront is set to use the S3 bucket as its origin server and will cache according to cache headers. CF will continue to serve the content even if expired
Will this work or is this more complex in terms of cached content (invalidation etc)?