Package Exports
- serverless-aws-function-url-custom-domain
- serverless-aws-function-url-custom-domain/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (serverless-aws-function-url-custom-domain) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
serverless-aws-function-url-custom-domain
Automatically creates AWS CloudFront distribution and Route 53 records to AWS Lambda with Function URL (no api gateway).
Installation
npm install --save-dev serverless-aws-function-url-custom-domainConfiguration
This plugin assumes your domain is hosted and managed with AWS Route53. SSL certificate is managed via certificate manager.
# add in your serverless.yml
plugins:
- serverless-aws-function-url-custom-domain
custom:
urlDomain:
domains:
- ${env:SUBDOMAIN}.yourdomain.com # custom domain 1
- ${env:SUBDOMAIN}-alt.yourdomain.com # custom domain 2
hostedZoneName: yourdomain.com. # your domain Route 53 hosted zone name
certificateArn: 'arn:aws:acm:us-east-1:xxxxx:certificate/xxxxx' # need to be located at NVirgina
route53: false # disable route 53 integration
functions:
api:
handler: wsgi_handler.handler
url: true # activate function URL!
Deploy
serverless deployInspect Result
serverless info --verboseOutput:
CloudFront domain name
xxxxx.cloudfront.net (CNAME: ${env:SUBDOMAIN}.yourdomain.com)
IAM Policy
In order to make this plugin work as expected a few additional IAM Policies might be needed on your AWS profile.
More specifically this plugin needs the following policies attached:
cloudfront:CreateDistributioncloudfront:GetDistributioncloudfront:UpdateDistributioncloudfront:DeleteDistributioncloudfront:TagResourceroute53:ListHostedZonesroute53:ChangeResourceRecordSetsroute53:GetHostedZoneroute53:ListResourceRecordSetsacm:ListCertificates
You can read more about IAM profiles and policies in the Serverless documentation.