Skip to content

πŸš€ By using this Terraform module, you can save time and effort in setting up your AWS static website. Its comprehensive Terraform code and thoughtful configuration options allow you to create a reliable, scalable, and performant static website on AWS without any problems.

License

Notifications You must be signed in to change notification settings

nulllogic/terraform-aws-website-static-cloudfront-s3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Terraform AWS static website module

Logo

contributors last update forks stars open issues license

The main objective of this module is to leverage the power of AWS services, specifically CloudFront and S3, to host and deliver your static website efficiently and securely. By utilizing Terraform's infrastructure as code capabilities, this project streamlines the deployment process, making it easy for you to set up and manage your AWS static website.

NullLogic

β”Œ Table of Contents ┐

πŸ—―οΈ Mandatory

  1. 🐳 Docker ( download )
  2. πŸ€– AWS account + security keys ( instruction )
    1. aws_access_key_id
    2. aws_secret_access_key

πŸ’­οΈ Optional

  1. Domain, located in Amazon AWS Route53

βš™οΈ Zero-config, one-minute setup with a single CLI command

πŸ” AWS providers for smooth deployment and certificate generation

⚑ Out-of-the-box support for static website

πŸ’ͺ Future-proof, robust architecture

🐳 Docker commands under the hood

βœ… Full test coverage

πŸ”’ Additional security headers

By using this project, you can save time and effort in setting up your AWS static website. Its comprehensive Terraform code and thoughtful configuration options allow you to create a reliable, scalable, and performant static website on AWS without any problems.

Feel free to explore the project on GitHub. Happy coding!

1st step:

Download two files main.tf and provider.tf from one of examples directories.

2nd step:

Run one of the following commands inside directory with those two files.
( it will use docker image with HashiCorp with TerraForm application inside)

If you have used AWS CLI already, you can attach keys by running this command:

docker container run -it --rm -v $PWD:/tf -v ~/.aws:/root/.aws --workdir /tf hashicorp/terraform:latest init

If you haven't used AWS CLI, you can pass those keys directly, by running this command: ( don't forget to replace XXXX with your AWS keys )

docker container run -it --rm -e TF_VAR_aws_access_key_id=XXXXXXXX -e TF_VAR_aws_secret_access_key=XXXXXXX -v $PWD:/tf --workdir /tf hashicorp/terraform:latest init

3rd step:

Run the command, that you used previously, but instead of init at the end of the command, write apply

It should look like this :

docker container run -it --rm -v $PWD:/tf -v ~/.aws:/root/.aws --workdir /tf hashicorp/terraform:latest apply

4th step:

Run the command, that you used previously, but instead of apply at the end of the command, write deploy

It should look like this :

docker container run -it --rm -v $PWD:/tf -v ~/.aws:/root/.aws --workdir /tf hashicorp/terraform:latest deploy

5th step:

Profit ! πŸ’ͺ


Example 1 -> CloudFront + S3

module "website-static-cloudfront-s3" {
 source  = "nulllogic/website-static-cloudfront-s3/aws"

 tags = {
    Environment = "dev"
    Terraform   = "true"
 }
} 


Example 1
Example 2 -> CloudFront + S3 + Domain

module "website-static-cloudfront-s3" {
  source  = "nulllogic/website-static-cloudfront-s3/aws"

  route53 = {
    domain = "example.com"
  }

  tags = {
     Environment = "dev"
     Terraform   = "true"
  }
} 


Example 2

β”Œ Contributing ┐

See Contributing

β”Œ Changelog ┐

See Changelog

β”Œ License ┐

Licensed under the MIT License

About

πŸš€ By using this Terraform module, you can save time and effort in setting up your AWS static website. Its comprehensive Terraform code and thoughtful configuration options allow you to create a reliable, scalable, and performant static website on AWS without any problems.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages