You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
S3
- Bucket for your app assets.
- Bucket access control.
- Bucket encryption support for AES256.
- Bucket versioning for your assets.
- Bucket for cdn access logs.
- Bucket Cors.
- Data rentention for access logs.Cloud Front Distribution
- SSL support.
- Access Logs.
- Cors support.
- Cname support.Acm - Https
- Certificate Creation.
- Certificate Validation.Dns Alias
- Route53 - Record for your CDN.
- ApiGateway - New Path for your CDNExtras
- Invalidate CloudFront cache on new deploys.
- Sync your local assets folder with s3 on new deploys.
- Extends resources configuration.
Usage
# serverless.ymlplugins:
- serverless-cloudfront-stackcustom:
cdnStack:
disabled: false # optional, disabled this pluginbeforeSpawn: ''# optional, run another hook plugincname: ''# optional, cname for cdn.createInRoute53: false # optional, default false, create cname recordcertificate: ''# required, if use cnameapigateway: ''# optional, use apigateway as http_proxy to cloudfrontbucketName: ''# required, app bucket nameenableCors: false # optional, enable cors default falseblockPublicAccess: true # optional, block public acccess to s3bucketEncryption: false # optional, bucket encryption for AES256bucketVersioning: false # optional, assets object versioning (backup)indexPage: ''# optional, default index.htmlerrorPage: ''# optional, default index.htmlbucketWebHosting: true # optional, default truesyncLocalFolder: ''# optional, folder path to sync with s3priceClass: ''# optional, default 'PriceClass_100'forwardHeaders: # optional, forward http headers
- Origin
- Accept-Encoding
- Your-Custom-Headerlogging: # optional tagbucketName: ''# required, logs bucket namepreffix: ''# optional, default 'Access/'retentionDays: 7# optional, default 21 days
Simple Example For Static Web App with ApiGateway (multiple front approach)
# serverless.yml# Your front-app will be accessed through api gateway# Assumptions: should be exists the apigateway and stagecustom:
cdnStack:
apigateway: apigateway-name:stage-dev/new-front-appbucketName: 'static-html-web-app'blockPublicAccess: truebucketWebHosting: truesyncLocalFolder: './dist'
Simple Example for Front Resources (webfonts, images, ...)
# serverless.ymlcustom:
cdnStack:
cname: 'cdn.dev.domain.com'createInRoute53: true # assumptions: exist hosted zone "dev.domain.com"certificate: '*.domain.com'# assumptions: exist acm cert "*.domain.com"bucketName: 'assets-front-resources'enableCors: trueblockPublicAccess: truebucketWebHosting: falsesyncLocalFolder: './dist'# psss. check full example in serverless.example.yml file.