AWS Static Site: Terraform
Table of Contents - Infrastructure as Code §
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 §
- An AWS account
- A Route53 hosted zone
- AWS Access Keys
Getting Started §
Terraform is written in HCL (Hashicorp Configuration Language).
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 1.0.4"
}
}
}
variable "aws_region" {}