Hands-on notes and walkthroughs on building and running workloads on Amazon Web Services - from static site hosting to infrastructure as code.
Static website hosting using S3 and CloudFront
A note on dates: this post was written in 2020 using Terraform 0.12 and the nodejs12.x Lambda runtime. The architecture still holds up well, but if you’re following along today, check the current AWS provider docs and use a supported Lambda runtime and Terraform version. In particular, the aws_s3_bucket resource has since been split into smaller resources (aws_s3_bucket_acl, aws_s3_bucket_logging, aws_s3_bucket_website_configuration and so on).
Recently I had the chance to create a static website using S3 and CloudFront.