0.9.29 • Published 1 month ago

serverless-aws-function-url-custom-domain v0.9.29

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

serverless MIT licensed npm version npm downloads pre-commit

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-domain

Configuration

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 deploy

Inspect Result

serverless info --verbose
Output:


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:CreateDistribution
  • cloudfront:GetDistribution
  • cloudfront:UpdateDistribution
  • cloudfront:DeleteDistribution
  • cloudfront:TagResource
  • route53:ListHostedZones
  • route53:ChangeResourceRecordSets
  • route53:GetHostedZone
  • route53:ListResourceRecordSets
  • acm:ListCertificates

You can read more about IAM profiles and policies in the Serverless documentation.

References

0.9.29

1 month ago

0.9.27

2 months ago

0.9.28

2 months ago

0.9.26

7 months ago

0.9.24

1 year ago

0.9.25

1 year ago

0.9.23

2 years ago

0.9.20

2 years ago

0.9.21

2 years ago

0.9.22

2 years ago

0.9.19

2 years ago

0.9.18

2 years ago

0.9.17

2 years ago

0.9.16

2 years ago

0.9.15

2 years ago

0.9.14

2 years ago

0.9.13

2 years ago

0.9.12

2 years ago

0.9.11

2 years ago

0.9.10

2 years ago

0.9.9

2 years ago

0.9.8

2 years ago

0.9.7

2 years ago

0.9.6

2 years ago

0.9.5

2 years ago

0.9.4

2 years ago

0.9.3

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.9.0

2 years ago