How to Host a Static Website on AWS With S3, CloudFront, Route53 and Terraform

Hosting a website on AWS using Cloudfront, S3 and Route53 is a popular solution for Amazon web hosting. It typically costs $3 a month outside the generous free tier and $0.50 within the free tier. Terraform can automate the deployment of this finicky architecture, making it much easier to deploy, manage and automatically upload website content. We will use an open-source Terraform module to deploy a secure, scalable, and performant website on AWS based on Route 53, CloudFront, and S3.

Architecture

The vast majority of Terraform tutorials I see covering similar topics all focus on recreating an identical architecture from stack utilizing resources which is simply a waste of time and effort. Existing tutorials and modules generally follow the architecture shown below, which is based on the AWS tutorials. Configuring a static website on Amazon S3 and Speeding up your website with Amazon CloudFront. Since they are based on tutorials, the following flaws remain:

CategoriesUncategorized