Search code examples
amazon-web-servicesaws-api-gatewayserverlessserverless-frameworkaws-serverless

Add custom domain to API gateway without serverless-domain-manager


I want to add a custom domain to the API Gateway using serverless framework but without "serverless-domain-manager" or any other plugin. I am looking for a more native way, maybe extending a resource in "serverless.yml"

All articles suggest that plugin, but it isn't the best for multi environment pipelines

https://www.serverless.com/blog/serverless-api-gateway-domain/


Solution

  • Doing it manually is not that complicated, here is the full explanation

    Add a custom domain to all envs

    1. Issue a certificate for the domain in the same region of serverless project, in my case us-east-2
    2. Go to API Gateway > Custom domain names > Create, use Regional endpoint type if using HTTP APIs
    3. In the created domain there is API Gateway domain name, you'll need to point a CNAME record to it
    4. Finally go to API mappings and create the mappings, in my case main and prod with stage $default