Skip to content
HCL script to spin up AWS EC2 static site
HCL HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
index.html
staticSite.tf

README.md

SRE CHALLENGE

This Terraform config spins up a simple static site using AWS EC2.

DEPENDENCIES

Before getting started, you'll need the following:

EXECUTION

First, make a config directory and put your main TF configuration staticSite.tf inside:

├── config
│   └── staticSite.tf

Next, add an HTML asset to the same directory:

├── config
│   └── staticSite.tf
    └── index.html

then store the following:

  • AWS access keys for IAM user
  • EC2 key pair name and path to private key

in a staticSite.tfvars file above config:

staticSite.tfvars
├── config
│   └── staticSite.tf
    └── index.html

staticSite.tfvars stores private values:

aws_access_key = "foo123"

staticSite.tf uses those values in variables:

variable "aws_access_key" {}

Finally, run the following:

$ terraform apply -var-file='../staticSite.tfvars'

inside the config directory to create your infrastructure!

You can’t perform that action at this time.