Published on

FREE - Automate hosting static site on S3 + Cloudfront using Terraform

Authors
  • avatar
    Name
    Minh LK
    Twitter

Terraform boilerplate for S3 + CloudFront

Progress?

  • Init infrastructure of Cloudfront + S3 Origin using Terraform
  • Github Next JS
  • Auto deploy with buddy

Getting Started

Prerequisites

Terraform CLI

Install Terraform CLI Link

Installation

  1. Install Terraform CLI
  2. Create User Terraform with S3/CloudFront permission using AWS IAM console
  3. Copy access_key and secret_key from AWS to ~/.aws/credentials file
File ~/.aws/credentials

[terraform]
aws_access_key_id = yyyyyyyyyyyyyy
aws_secret_access_key = xxxxxxxxxxxxxxx
region=ap-northeast-1
  1. Change bucket name simple-blog to an unique name
  2. Deploy to aws using TF CLI
terraform init
terraform deploy
  1. Clean up after using
terraform destroy