Skip to content

ValAug/S3_CloudFront_Webdeployment

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

S3_CloudFront_Webdeployment

Secure static website dynamically deploy it with Terraform hosted in AWS

Cloud - ☁️

AWS

IaaC

Terraform

AWS S3 and CloudFront architecture diagram

alt text

Note

module.static_web_01 will be creating resource such AWS Cloudfront distribution for an S3 bucket with web static files.

module.static_web_02 will be creating resource such AWS Cloudfront origin OAI for an S3 bucket with web static files.

Proper security policies for S3 buckets and CloudFront are still require in both deployments.

Purpose

Shows how to use AWS with Terraform to accomplish the following tasks:

  • Create one or multiple S3 buckets to storage/host static web files
  • Create a CloudFront for a fast content delivery network (CDN)

Prerequisites

  • You must have an AWS account, and have your default credentials and AWS Region configured
  • You must have Terraform installed
  • You must create static files (HTML, CSS, JavaScript) and storage them in your bucket

Cautions

  • As an AWS best practice, grant this code least privilege, or only the permissions required to perform a task. For more information, see Grant Least Privilege in the AWS Identity and Access Management User Guide.
  • This code has been tested in us-east-1 AWS Regions only. However it should work in any other region.
  • Running this code might result in charges to your AWS account.

How to run this code

  • Clone this repo
  • cd to S3_CloudFront_Webdeployment folder
  • terraform init
  • terraform plan
  • terraform validate
  • terraform apply
  • Alternate command : terraform apply -auto-approve
  • terraform destroy
  • Alternate command : terraform destroy -auto-approve
  • terraform fmt # A way to format the terraform code

About

Secure static website dynamically deploy it with Terraform hosted in AWS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages