JSPM

serverless-plugin-custom-domain

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 350
  • Score
    100M100P100Q93857F
  • License MIT

Set up and cut over custom domains for API Gateway

Package Exports

  • serverless-plugin-custom-domain

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

This is a plugin for Serverless that injects a CloudFormation Custom Resource in your deployed stack that sets up a base path mapping between the ApiGateway::Deployment that Serverless creates, and an API Gateway Custom Domain.

Usage


service: my-service

plugins:
  - serverless-plugin-custom-domain

custom:
  domain: "${opt:region}.myservice.foo.com"

Notes

Why a Custom Resource?

CloudFormation supports ApiGateway::BasePathMapping resources but I found they frequently fail to update correctly. Implementing the (relatively simple) logic to get-and-update-or-create combined with a remove hook for cleanup has proven to be more reliable.

Setting up the Custom Domain

These take a long time to provision and are long-lived persistent resources that have Route53 entires pointing at them as well as ACM certificates that have to be requested and approved. You should manage these outside of Serverless, either via CloudFormation or something like Terraform.