Skip to content

Blog

Hosting a statically-generated website on AWS using Terraform Cloud

Introduction

After preparing for the AWS and Terraform associate exams, I decided to build a small project to put some concepts into practice. Additionally, I took the chance to explore Terraform Cloud (TFC).

Objective: Host a statically-generated website on AWS

Design Decisions (DD):

  1. AWS services will be provisioned and managed using Terraform
  2. TFC workspaces/modules & GitHub repositories will be provisioned and managed using Terraform
  3. Terraform HCL code used by TFC will be stored in GitHub repositories for version controlled goodness. TFC will manage and store the Terraform state files.
  4. Website files will be stored in a GitHub repository and GitHub Actions will be used to build and sync the website files to AWS. In this instance, I'm using the statically-generated website framework Material for MkDocs to build the website from markdown files.
  5. Website will be deployed to a test environment before rolling out to the production environment
  6. Production website will be served using CloudFront. Test website will be served using native S3 static website hosting
  7. Monthly run costs should be kept as loss as possible