AWS Static Site: Terraform

/ aws, terraform, hugo, blogging

Table of Contents - Infrastructure as Code #

  1. Intro
  2. AWS Static Site: Cloudformation
  3. AWS Static Site: Terraform
  4. AWS Static Site: CDK

Terraform #

When I began my blog this year and started using Hugo to generate the site, I thought first of hosting it on AWS. A simple static site has very few needs: a place to store and serve up the generated files, and a place to create DNS records for visitors to use to get to my site.

AWS S3 has a feature allowing it to serve up files and AWS Route53 is a nice cheap place to register a domain and manage my DNS records. Let's see what it looks like to build out the infrastructure for a static site using using Terraform.

Prerequisites #

Getting Started #

Terraform is written in HCL (Hashicorp Configuration Language).

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 1.0.4"
    }
  }
}

variable "aws_region" {}