serverless plugin to setup custom domain for lambdas deployed with function url.

Overview

serverless MIT licensed npm version npm downloads

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

You might also like...

☁ ⚡ Serverless v2/v3 plugin to add custom dependsOn to CloudFormation resouces.

serverless-custom-depends-on Serverless v2/v3 plugin to add custom dependsOn to CloudFormation resouces. What it does It helps you to add the "Depends

Dec 23, 2022

Learn Web 2.0 and Web 3.0 Development using Next.js, Typescript, AWS CDK, AWS Serverless, Ethereum and AWS Aurora Serverless

Learn Web 2.0 Cloud and Web 3.0 Development in Baby Steps In this course repo we will learn Web 2.0 cloud development using the latest state of the ar

Jan 3, 2023

A Serverless GraphQL Sample project using Apollo and Serverless Framework with TypeScript and Webpack.

Serverless GraphQL Boilerplate This is a base project with a structure that includes Serverless Framework, Apollo, TypeScript and Webpack. It can be d

Aug 23, 2022

AWS Lambda & Serverless - Developer Guide with Hands-on Labs. Develop thousands line of aws lambda functions interact to aws serverless services with real-world hands-on labs

AWS Lambda & Serverless - Developer Guide with Hands-on Labs. Develop thousands line of aws lambda functions interact to aws serverless services with real-world hands-on labs

AWS Lambda & Serverless - Developer Guide with Hands-on Labs UDEMY COURSE WITH DISCOUNTED - Step by Step Development of this Repository - https://www

Dec 17, 2022

A serverless function that auto commits your daily total time tracked on Wakatime to Github.

A serverless function that auto commits your daily total time tracked on Wakatime to Github. Using Netlify Scheduled Functions, Github GraphQL API, and Wakatime API.

Oct 8, 2022

A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM deffiniation and appropriate file structure.

Welcome to function-stencil 👋 A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM

Jun 20, 2022

Tries to execute sync/async function, returns a specified default value if the function throws

good-try Tries to execute sync/async function, returns a specified default value if the function throws. Why Why not nice-try with it's 70+ million do

Dec 8, 2022

Wrap a function with bun-livereload to automatically reload any imports inside the function the next time it is called

bun-livereload Wrap a function with bun-livereload to automatically reload any imports inside the function the next time it is called. import liveRelo

Dec 19, 2022

First smart contract deployed on Rinkeby.

First smart contract deployed on Rinkeby.

Inbox-Contract First smart contract deployed on Rinkeby. It has a basic constructor which accpets a string and assigns the string to the message varia

Dec 26, 2021
Owner
Sha
Sha
Backend API Rest application for ShortLink, a URL shortening service where you enter a valid URL and get back an encoded URL

ShortLink - The Shortest URL (API) Sobre o Projeto | Como Usar | Importante! Sobre o projeto The Shortest URL é um projeto back-end de ShortLink, um s

Bruno Weber 2 Mar 22, 2022
Proof of concept: support immutable trpc servers using lambdas to ensure client/server compatibility

auto-versioned-trpc-aws-lambda Proof of concept to support an automatically versioned AWS Lambda running tRPC to ensure a somewhat graceful and automa

Kenneth Skovhus 5 Aug 30, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Kuldeep 2 Jun 21, 2022
Use Cloudflare Pages Functions as a reverse proxy with custom domain support.

cf-page-func-proxy Use Cloudflare Pages Functions as a reverse proxy with custom domain support. Getting Start 1.下载或是Fork本仓库 2.修改_worker.js中的url.hostn

null 121 Dec 23, 2022
Piccloud is a full-stack (Angular & Spring Boot) online image clipboard that lets you share images over the internet by generating a unique URL. Others can access the image via this URL.

Piccloud Piccloud is a full-stack application built with Angular & Spring Boot. It is an online image clipboard that lets you share images over the in

Olayinka Atobiloye 3 Dec 15, 2022
Allows you to build fetcher function by URL at compile-time.

fetch.macro Allows you to build fetcher function by URL at compile-time. Usage Simply install and configure babel-plugin-macros and then use fetch.mac

RiN 18 Nov 7, 2022