Custom Domains
By default, all instances on Serverless Cloud have a URL that ends with cloud.serverless.com
. You may want to replace this domain with a domain that you already own.
Note that you cannot set a domain for developer sandboxes or preview instances as they are temporary. You’ll need to create a permanent stage by using cloud deploy
command from your terminal, or deploy
on Cloud Shell, or by creating a new stage on the Dashboard.
There are two steps that you need to take to assign a custom domain to your instance:
- Verify your ownership of the domain
- Map the domain to the Serverless Cloud stage
Verifying Custom Domain Ownership
To map a custom domain to your application, you must first prove ownership of the domain by adding a CNAME entry at your domain registrar. Follow the steps below to verify the ownership of the custom domain:
- On the settings section of one of your stages, navigate to the "Domains" tab. You’ll see a domain that’s assigned by Serverless Cloud for this instance.
- Click on "Add new domain" and enter the name of the domain that you would like to assign for this instance in the dialog. Note that you can map subdomains following the steps here. See our documentation about naked domains.
- You’ll see the first CNAME Name/Value pair that you use to prove the ownership of the custom domain. See in the image below the Name equals
_4453ae612288a32ae779be80e251735c.cooldomain.emrahsamdan.com
while Value equals_18cd929a9bd28592b7c824fa456bdbb4.bwzjrqdvsp.acm-validations.aws.
- Go into the DNS page of your domain registrar and add the CNAME there. Note that some registrars require you to provide the whole string for the Name, while others need only the part of your custom domain name,
_4453ae612288a32ae779be80e251735c.cooldomain
in our example. Godaddy, for example, warns you about this issue if you enter the whole string in the Name area. Google Domains also do not need the full domain but they don't give you a warning.
- It may take a few minutes for your changes to take place. You can click the "Refresh" button on the Serverless Cloud Dashboard to track the progress. After a few minutes, you’ll see that your ownership of the custom domain is verified as below. Now we can continue to map our domain to our instance.
Mapping Custom Domain to Serverless Cloud Instance
Continue from the previous step by adding another CNAME record at your domain registrar. See the image below to see the CNAME records added on GoDaddy.
This can also take a few minutes for the mapping operation to complete. You can test the mapping by visiting the custom domain you selected. Please check your DNS records if the operation doesn’t succeed or reach out to us for help.
Mapping Naked Domains
A naked domain (a.k.a. apex domain) is a domain without a subdomain. In our example, it’s emrahsamdan.com
.
Note that www.emrahsamdan.com
is still a subdomain and you can add it as described above.
You can map naked domains to your Serverless Cloud instance, but your DNS provider must support this as well. Your DNS provider should support adding ALIAS
records (also known as A ALIAS
or A NAME
). See the below list of DNS providers that support ALIAS
records.