Giter Site home page Giter Site logo

geekinc / cloudformation-static-site Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stefanolaru/cloudformation-static-site

0.0 0.0 0.0 4 KB

Create a static site in AWS with a custom domain, SSL certificate, and proper redirects using CloudFormation.

HTML 100.00%

cloudformation-static-site's Introduction

cloudformation-static-site

Create a static site in AWS with a custom domain, SSL certificate, and proper redirects using CloudFormation.

Read an extensive post about this repo

Please update the package.json per your needs.

Create the stack

The create-stack command is as below:

aws cloudformation create-stack \
--stack-name STACK_NAME \
--template-body file://template.yml \
--profile AWS_PROFILE \
--region us-east-1 \
--parameters ParameterKey=DomainName,ParameterValue=DOMAIN_NAME ParameterKey=HostedZoneId,ParameterValue=HOSTED_ZONE_ID

Where

  • STACK_NAME - is your stack name
  • AWS_PROFILE - is your credentials profile in the
  • DOMAIN_NAME - is your domain name (the naked domain, e.g. example.com)
  • HOSTED_ZONE_ID - is your Route53 zone for the domain, should look like Z07414553OA4KK51T5EZA

Deploy the site

The deploy command will deploy your static site to the S3 bucket and invalidate the CloudFront cache. You may update as per your needs, by default the copy command excludes all paths in the current folder, in order to prevent deploying sensitive info.

aws s3 cp ./ s3://S3_BUCKET_NAME \
--acl public-read \
--profile AWS_PROFILE \
--recursive \
--exclude "*" \
--include index.html \
--include 404.html \
&& aws cloudfront create-invalidation \
--profile monithor \
--distribution-id DISTRIBUTION_ID \
--paths "/*"

Where:

  • S3_BUCKET_NAME - is your S3 bucket name
  • AWS_PROFILE - is your credentials profile
  • DISTRIBUTION_ID - is your CloudFront distribution ID

cloudformation-static-site's People

Contributors

stefanolaru avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.