Skip to content

Serverless plugin to configure S3, CloudFront and Route53 for a SPA or JAMStack site.

Notifications You must be signed in to change notification settings

DanteInc/serverless-spa-config

Repository files navigation

serverless-spa-config

Serverless plugin to configure S3, CloudFront and Route53 for a SPA or JAMStack site.

  • Creates S3 Website bucket
  • Creates CloudFront distribution (unless disabled:true)
  • Creates Route 53 RecordSet (unless disabled:true or hostedZoneId:undefined or endpoint:undefined)
  • Creates S3 Website redirect bucket (when redirect:true)
    • And creates corresponding CloudFront distribution and Route 53 RecordSet

This plugin is designed to work in conjunction with the serverless-spa-deploy plugin.

serverless.yml

Optional settings are commented out and show default values

plugins:
  - serverless-spa-deploy
  - serverless-spa-config

custom:
  spa:
    files: # per serverless-spa-deploy
      ...
    # redirect: true
  dns:
    hostedZoneId: ZZZZZZZZZZZZZZ
    domainName: example.com
    endpoint: app.${self:custom.cdn.domainName}
  cdn:
    aliases:
      - ${self:custom.cdn.endpoint}
    acmCertificateArn: arn:aws:acm:us-east-1:account-id:certificate/certificate-id
    # priceClass: PriceClass_100
    # api:
    #   domainName: ${opt:stage}-api.${self:custom.dns.domainName}
    #   pathPattern: /api-*
    #   # originPath: /${opt:stage}
    # failover: 
    #   # criteria: [ 500, 502, 503, 504 ]
    #   us-west-2:
    #     bucketDomainName: ${self:service}-${opt:stage}-us-east-1.s3.us-east-1.amazonaws.com
    #     originAccessIdentityId: ${cf(us-east-1):${self:service}-${opt:stage}.WebsiteBucketOriginAccessIdentityId, 'UNDEFINED'}
    #   us-east-1:
    #     bucketDomainName: ${self:service}-${opt:stage}-us-west-2.s3.us-west-2.amazonaws.com
    #     originAccessIdentityId: ${cf(us-west-2):${self:service}-${opt:stage}.WebsiteBucketOriginAccessIdentityId, 'UNDEFINED'}
    # logging:
    #   bucketName: ${self:custom.cdn.logging.bucketName}.s3.amazonaws.com
    #   prefix: aws-cloudfront
    # webACLId: arn:aws:waf::account-id:resource-type/resource-id
    # disabled: true
    # enabled: stage1,stage2

About

Serverless plugin to configure S3, CloudFront and Route53 for a SPA or JAMStack site.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published