Skip to content

Terraform modules to create a static website hosted on CloudFront using ACM, S3 bucket and route53 for DNS

Notifications You must be signed in to change notification settings

gabriel8fm/aws-cdn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CDN to static site hosting

This project creates a complete static site hosting. To this purpose we use these AWS services:

  • Cloudfront
  • S3
  • ACM
  • Route 53

Directory Structure

Directory Structure

Modules

  • ** Cloudfront **

Responsible to creating the CDN configuration.

  • ** S3 **

Creates a public S3 bucket.

  • ** ACM **

Reponsible to enable custom certificates to the static website.

  • ** main.tf **

Root configuration about providers and modules that will be necessary.

Terraform Init

Note: Before starting the terraform commands, it is important to have configured the hosted zone in route53 with the domain that will be used in this module, after making this configuration just inform the domain in the main.tf file.

First you will have to configure your AWS credentials on this file / home / user / .aws / credentials. Then run:

terraform init

This command will install all modules dependencies.

Terraform Plan

To validate the resources that will be create on AWS account, run this:

terraform plan

Terraform Apply

If your validation was ok, then you can create all resources running this:

terraform apply

Once successfully completed, simply upload an index.html file into the bucket and attempt access via CDN endpoint.

Terraform Destroy

OMG, I don't like this... then run::

terraform destroy

References

Terraform

cloudfront

S3

ACM

route53

About

Terraform modules to create a static website hosted on CloudFront using ACM, S3 bucket and route53 for DNS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages