Quickly deploy a static site to AWS using Terraform, S3 and CloudFront (without a custom domain).
To deploy a static site quickly to CloudFront with a custom domain, please use tkav/cloudfront-static-site.
This is a template repo! Click Use this template
before continuing on.
Then clone and open this repo.
- Terraform (>v1.0.0)
- Update
variables.sh
and load environmental variables:
source variables.sh
-
Replace and add your static website contents to
src
folder. The distribution will look forindex.html
and404.html
pages. Make sure you have those. -
Deploy your site:
make deploy_site
When completed, something like the following will be outputted:
Outputs:
cloudfront_domain = "dlimer79nfhej.cloudfront.net"
Your site is now available at the cloudfront_domain
.
If changes are made in the src
folder, run the following to upload the changes to your S3 bucket:
make upload_site
This will also be run when contents are pushed to the repo with changes in the src
folder.
To destroy everything to do with this deployment:
make destroy
And confirm the steps. S3 buckets, Cloudfront distributions and certificates will be deleted!