- Access to a minimum of set of AWS resources is required, else administrator access to AWS would be ideal.
- Terraform state is local state for simplicity.
- For this exercise I am exporting the
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
for a test account I have on my personal AWS account. I am sure you all have IAM roles and profiles you assume per your accounts/environments, but wanted to make a note just in case.
eg:
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""
Cloudfront, an s3 bucket, cloudwatch and WAF as the infrastructure (AWS services) used to deploy the Single Page Application.
- Single page application, there is no need to provision subnets, networks, albs, gateways or routing tables to provide access to the application.
- I do believe this is more cost effective, a lot less resources to provision, keeping cost down.
- Based on AWS documentation the above resources are a minimum for a single page application.
- It seemed easier to write the code to provision the resources and less work :).
- Clone repo
git clone [email protected]:smetroid/static-site-tf.git
- Download terraform modules and plugins
terraform init
- Provision and deploy the application
terraform apply
- Go to the CloudFront URL found in the output when terraform apply finishes eg:
Apply complete! Resources: 13 added, 0 changed, 0 destroyed.
Outputs:
app_url = {
"dev-spa" = "d6xtsfw2dnceh.cloudfront.net"
}
- terraform destroy