Setting up a Dreamhost domain on Begin.
Tags: aws, dns, serverless, dreamhost
Published: 2021-01-22 15:11:36

## Introduction

> This article will give you a complete walk-through for setting up your Dreamhost domain on your Begin app. The entire process should take no longer than 10 minutes.

Although you may use a free registrar-based DNS to host your domain on Begin such as Godaddy, Namecheap, One.com, etc., Route53 is the preferred registrar and DNS management system for Begin users:

- It's integrated with Amazon's other cloud services.
- Your DNS will resolve from 15+ locations worldwide, making your website faster for your end-users.
- Route53 is a DNS management system (Smart DNS) compared to all the others, which are merely domain registrars with a limited feature set for manipulating DNS.

Check out our guide for [Setting up an AWS Route53 domain on Begin](https://dev.to/shawnhosea/setting-up-an-aws-route53-domain-on-begin-4gcm)

---

> This article assumes that you have already: 
- signed up for Dreamhost 
- purchased the domain of your choice 
- created your Begin app to map your domain

## Step 1: Getting started.

The first step in domain mapping is to enter the domains you'll be using.

![Screen Shot 2021-01-19 at 9.41.05 AM](https://dev-to-uploads.s3.amazonaws.com/i/l7lmmqghuv8cm3uatye3.png)

Begin's first-class support for staging environments means you'll need to add a staging domain (or subdomain), too.

Say your domain is `www.example.com`. We'd suggest keeping it simple and setting your staging domain to staging.example.com – but you can also opt to configure it to be `examplestaging.net` if you prefer.

This article is for users that want to map a `naked domain`. A naked domain (also referred to as a zone apex) is simply a domain set up to respond to requests without a subdomain. For example:

- `https://begin.com` is a web address using a naked domain
- `https://docs.begin.com` has a subdomain and is thus not a naked domain.

Dreamhost has the ability to add ALIAS records (also sometimes called `ANAME`, or `A ALIAS`), to create a mapped naked domain. 

In the next step, you'll enter the first two values in your DNS provider's interface, which will prove you own your domains and generate your SSL certificates.

## Step 2: Verify your ownership of the domain(s).

In this step, you'll need to add two `CNAME` values to your Dreamhost DNS to verify your ownership of the domain and generate your SSL certificates for HTTPS.

![Screen Shot 2021-01-19 at 9.43.15 AM](https://dev-to-uploads.s3.amazonaws.com/i/mcno4j5onvus7u9nv4dk.png) 

Head back to the Dreamhost console and navigate to the `DNS records` page for your specific domain. During the SSL verification step, the first part of the name gets entered as your `CNAME` subdomain, and the value is inputted as the value. For instance, when you're provided the following `CNAME` entry:

- **Name:** `_2f9b34277e4b159e0beaa859e8802a93.www.example.com`
- **Value:** `_58cb94c5d71976edd03e8303fc1a126b.acm-validations.aws.`

You'll add a CNAME subdomain of 

- `_2f9b34277e4b159e0beaa859e8802a93` within your Dreamhost DNS console `Host` zone.

Then, set its `Points to` to 
- `_58cb94c5d71976edd03e8303fc1a126b.acm-validations.aws.`

Due to the eventually consistent nature of DNS-based verification, it may take a few minutes for your changes to get picked up. Check back after a few minutes, and your values should be green, and you should be able to complete the next and final step.

> If, for some reason, after more than a few minutes, your domains haven't verified, make sure that you've correctly entered the settings into your DNS.

## Step 3: Map the domain to your Begin app.

In the final step, you'll add the final `CNAME` and `ALIAS` records to your Dreamhost. This points your domain at your Begin app.

![Screen Shot 2021-01-22 at 7.26.18 AM](https://dev-to-uploads.s3.amazonaws.com/i/67ero267uzdzf1o0p0wj.png) 
 
When you provide the `CNAME` record:

- Switch to the `CNAME` record setting.
- **Name:** `staging`
- **Value:** `exampleurl.cloudfront.net`

When you provide the `A` record:

- Switch to the `ALIAS ` record setting.
- **Name:** leave blank
- **Value** section, add the Cloudfront URL given by Begin.

## Conclusion

Now we're done! You can check to see if your domains are online with this [DNS Checker tool](https://dnschecker.org/).

Keep in mind that it takes a few hours for DNS to propagate fully, so be patient.

### Starting over

Something not looking right? No sweat, DNS can be finicky. If you need to hit the reset button, click Start over (or, if you've finished mapping your domain, Delete domain mapping).

Your app will then be restored to its original `yourappname.begin.app` URLs, and you'll be able to re-map your domain again.