Serverless Framework + AWS: automatically creating certificate and domain for your app

This is a guide showing how you can automatically create an SSL certificate on Amazon Certificate Manager (ACM) and configure a subdomain on Route 53 Hosted Zone using Serverless Framework with some wonderful plugins.

Tiago Boeing
2 min readFeb 25, 2022


Before start:

Firstly, you need to know that we'll use some Serverless Framework plugins to turn our life easier:

Note: I’ll show some scripts using NodeJS, but Serverless Framework can be used on almost any language (to not say literally anywhere).

With this in mind, let's go ahead! Start installing dependencies:

npm install serverless-domain-manager serverless-certificate-creator -— save-dev

Create a custom domain section

I usually separate domains to allow customization for each one, it would be like this in my stack:

Of course, the certificate name is chosen by you. I only like to use the same name of the domain to keep easier to locate on ACM.

This is the way how I organize my apps, take this as an example to customize/start.

See our custom section:


Take the following tips and tricks:

Deploying to another stage (not on the default: dev) you need to use the option --stage (read more here). As an example for the first time you can use:

# First deploy PROD stage serverless create-cert --stage=prodserverless deploy --stage=prod

It’s possible to manually generate a domain using serverless-domain-manager, you can do it using the command serverless create_domain, this isn’t needed if you have the autoDomain flag enabled (as mentioned earlier).

Complete stack

See the complete Serverless stack below.



Tiago Boeing

🇧🇷 Software engineering specialist | AWS Community Builder | ⌨ Works at Via Varejo | @tiagoboeing