28
loading...
This website collects cookies to deliver better user experience
cd to-my-serverless-project
npm install --save-dev serverless-hosted-zone
serverless.yml
configuration file:plugins:
# add to the previous entries
- serverless-hosted-zone
custom:
# add to the previous entries
# see the documentation for all the options
hostedZone:
name: customdomain.com. # Note the trailing dot
sls create-zone
npm i --save-dev serverless-certificate-creator
serverless.yml
configuration file:plugins:
# add to the previous entries
- serverless-certificate-creator
custom:
# add to the previous entries
# see the documentation for all the options
customCertificate:
certificateName: customdomain.com
idempotencyToken: customdomaincom
hostedZoneNames: customdomain.com. # Note the trailing dot
sls create-cert
npm install -g serverless
serverless.yml
configuration file:plugins:
# add to the previous entries
- fullstack-serverless
custom:
# add to the previous entries
# see the documentation for all the options
fullstack:
domain: customdomain.com
certificate: arn:aws:acm:us-east-1: # use the actual ARN
bucketName: customdomain.com # the desired bucket name
distributionFolder: my-website-files-dir # assumes it is in the same directory
indexDocument: index.html
errorDocument: error.html
singlePageApp: true
compressWebContent: true
# no-generate-client option because only using static files
# omit if you are using a reactive framework (e.g., React, Vue, Nuxt, Next)
serverless client deploy --no-generate-client
customdomain.com.
hosted zone for you and the plugin checked for it.abc1d2efghij4.cloudfront.net.
), or you can go to the AWS console to get the CloudFront distribution DNS name. Go to your DNS provider and create an ALIAS record pointing to abc1d2efghij4.cloudfront.net.
so anyone that visits https://customdomain.com
will see your new serverless website.