Setting Up a Custom Domain for API Gateway without Route53 using Serverless Framework

Setting Up a Custom Domain for API Gateway without Route53 using Serverless Framework

In the world of serverless computing, API Gateway is a crucial component for building and deploying web APIs. While Route53 is a popular choice for managing custom domains, it may not always be the preferred solution.

In this blog post, we will guide you through the process of setting up a custom domain for API Gateway without using Route53. Instead, we'll be using the Serverless framework, a popular open-source framework for building and deploying serverless applications.

Whether you're a beginner or an experienced developer, this guide will provide you with the knowledge and tools you need to set up a custom domain for your API Gateway with ease.

Steps to do in Serverless Project

Create a new Serverless project

Run the following command in your terminal to create a new Serverless project:

serverless create --template aws-nodejs

Define Custom Domain

Define the custom domain in serverless.yml:
Use serverless-domain-manager for easy use. In your serverless.yml file, add the following code to define the custom domain name:

  basePath: 'api'
  stage: ${self:provider.stage}
  createRoute53Record: false

Deploy the API Gateway

Run the following command to deploy the API Gateway with the custom domain name:

serverless deploy

You've to run the below code to create the domain: serverless create_domain

After running the serverless deploy, you will get the below output. Distribution Domain Name is the one we need to note down.

Serverless Domain Manager Summary
Domain Name
Distribution Domain Name

Steps to do in AWS

Request AWS Certificate

Update API Gateway Domain Name

Now you've to use the create option from the API Gateway to use the custom domain.

Update the Domain Name's DNS Records

Go to your domain registrar's website and update the nameservers for the custom domain to the ones provided by the output from the sls deploy (for eg:

And that's it! You now have a custom domain for your API Gateway that's been set up using the Serverless framework without using Route53.

Please share this post if you think it's going to help someone.

Let's connect,

Did you find this article valuable?

Support Dorothi Viki by becoming a sponsor. Any amount is appreciated!