项目作者: smoketurner

项目描述 :
AWS project to deploy a CDN for hosting static assets in private S3 buckets
高级语言:
项目地址: git://github.com/smoketurner/sam-cdn.git
创建时间: 2019-12-17T20:49:28Z
项目社区:https://github.com/smoketurner/sam-cdn

开源协议:MIT License

下载


MIT licensed
build status
serverlessrepo:us-east-1:860114833029:applications/cloudfront-cdn">Launch Stack

A project that deploys a content delivery network (CDN) using AWS CloudFront for static assets hosted in a private S3 bucket.

This project creates the following resources:

  • AWS::CertificateManager::Certificate - *.<domain> SSL certificate
  • AWS::CloudFront::Distribution - [http|https]://<domain> distribution
  • AWS::CloudFront::Distribution - [http|https]://www.<domain> redirect distribution
  • AWS::CloudFront::CloudFrontOriginAccessIdentity
  • AWS::Route53::RecordSet - <domain> IPv4 DNS entry
  • AWS::Route53::RecordSet - <domain> IPv6 DNS entry
  • AWS::Route53::RecordSet - www.<domain> IPv4 DNS entry
  • AWS::Route53::RecordSet - www.<domain> IPv6 DNS entry
  • AWS::S3::Bucket - private access log bucket
  • AWS::S3::Bucket - private static asset bucket
  • AWS::S3::Bucket - private bucket to redirect requests to https://<domain>
  • AWS::S3::BucketPolicy - only allow CloudFront to access static asset bucket
  • AWS::CloudFront::Function - CloudFront Function for single page applications to redirect requests to /index.html
  • AWS::CloudFront::Function - CloudFront Function to add various web security HTTP response headers

Installation

  1. git clone https://github.com/smoketurner/sam-cdn.git
  2. cd sam-cdn
  3. npm install

Deploy

  1. npm run build
  2. npm run deploy

You can upload your static assets into the S3 bucket and Route53 and CloudFront will take care of any redirections and content serving for you.

References