Setting Up a Custom Domain and Email Address with AWS SES

Charles Campbell
8 min readJun 7, 2023

--

If you’ve ever bought a Custom Domain, chances are you also wanted to associate an email address with it, but didn’t want to pay for an email hosting service. Here’s a step by step guide to set up a custom email address using AWS.

A few years back I decided I wanted to secure my name’s domain so I went to one of the domain registrar’s to see if it was available only to find that somebody else had already registered charlescampbell.com. Not to be deterred, I filled out the form that the registrar provided indicating that I was interested in buying it off the person who had already secured it. A year or two went by and I finally got the opportunity to buy the domain off the person…I think I ended up paying like $150. Although much more expensive than most domains, I thought it was a small price to pay for the domain matching my name.

Now if you’ve ever bought a custom domain, you probably not only wanted to setup a website, but you also wanted to setup an email address for your custom domain. I’m going to show you the steps I took to set this up using AWS.

You can buy a custom domain with AWS using the Route 53 console (hopefully you don’t have pay as much as I did to get your custom domain!). They cost anywhere from $9 and up. Here is some documentation on how to register a new domain with AWS.

Once you have your domain, you can get a static website up and running relatively quickly. Here is a guide that AWS provides on how to get a static website up and running relatively quickly.

I decided to use the Gatsby framework in order to setup the latest version of my personal site (which is still under development as of writing this story).

Screen shot of personal website.

And at the bottom of my page I wanted to include an email address such as me@charlescampbell.com for my personal domain that I can be contacted at. Now, I don’t want to pay for a full email hosting service, I just want the emails to be forwarded to a Gmail account I already use.

Contact me section on personal website

In the next section, I’ll walk you through the steps I took to setup my email address to associate it with my custom domain using AWS. Here are the steps we will need to take:

  • Register Your Custom Domain with AWS Route 53
  • Verify the New Domain with AWS SES
  • Registering the MX Record with Route 53
  • Create an Email Receiving Rule Set
  • Subscribing to the SNS Topic
  • Verify Email Address with AWS SES

Register Your Custom Domain with AWS Route 53

The first thing you need to do is make sure your custom domain is registered in Route 53. Here is some documentation on registering a domain with Route 53.

Route 53 registered domain

Verify the New Domain with AWS SES

Next, we’ll use the Simple Email Service to verify the custom domain (e.g. charlescampbell.com) and the email address (me@charlescampbell.com).

In the AWS console, navigate to SES > Configuration: Verified Identities and click the Create Identity button.

Once you click the button, a new page will appear. Here are the settings I entered into that page:

Verifying your domain screen shot

Hit the button at the bottom to finalize the verification form and you will see a page indicating that the verification process is pending.

Screen shot of pending verification.

It takes a few minutes for the settings to propagate to Route 53 and the DNS records to be updated, but once you refresh the page a couple of times you should see that the domain has been verified successfully.

If you navigate to your Route 53 console, you’ll see that 3 new entries have been added to your hosted zone records. These are DNS entries and they do three things for us:

  • Prove to SES that we own the domain we’re trying to use
  • Establish the DKIM records which will allow others to know who we are when AWS SES sends emails for us
  • Allows AWS SES receive emails on behalf of our domain

These records could be used by any Domain Registrar to achieve our goal. However, because we’re using Route 53, we can have AWS manage all of it for us.

Registering the MX Record with Route 53

The next step is to register an MX record in Route 53 so that other mail servers can send messages back and forth to your custom domain. This is a very important step! Here is documentation on how to add an MX record to your Route 53 hosted site. Once finished, you should see an entry similar to this in your Route 53 DNS entries:

Create an Email Receiving Rule Set

Next, we need to create an email receiving rule. In the AWS console, navigate to SES > Configuration: Email Receiving and click the Create Rule Set button.

Give your Rule Set a unique name and click continue. Next you’ll need to create a rule by clicking the Create Rule button:

Enter a name for the rule and check the box for TLS required, then click Next.

Define rule settings

On the Add recipient conditions page, you’ll need to add the email addresses that you want to be able to receive emails through AWS SES. I’m registering me@charlescampbell.com so that I can receive emails to that address.

Now, you will need to define the action that will occur once somebody sends an email to the address. As I mentioned earlier, I just want all emails received at this email address to be forwarded to my Gmail account. In order to do that, we need to select the action Publish to Amazon SNS topic.

This is an important part, because this is where we tell AWS what to do with any emails that are sent to the new email addresses we’ve registered. This includes the verification emails that AWS SES will send.

We’ll use the Simple Notification Service (SNS) so that when SES receives an email to me@charlescampbell.com, it will publish that email on to an SNS Topic that we create here.

Choose Create SNS Topic and give the topic a name. Click save on the popup and then click Next to go to the last step, which is Review.

You’ll then get a chance to review your new Rule Set before clicking “Create Rule”.

Subscribing to the SNS Topic

So far I’ve shown you how to create a system which will push any emails received by me@charlescampbell.com to a new SNS Topic. Next, we have to subscribe to that Topic in order to get access to those emails.

To do this I’m going to subscribe using my personal email address, e.g. example@gmail.com.

In the AWS console, navigate to SNS > Topics and click on the Topic you created in the previous step.

Go to the Subscriptions tab and click on Create Subscriptions.

Leave the Topic ARN as default (this will be your new Topic). Then select “Email-JSON”. We choose JSON because the “Email” option will not format links properly when viewed in your email.

Enter your personal email address and click “Create Subscription”.

A few seconds later you should receive an email. This is to confirm your subscription. Within the email, find the link entitled “SubscribeURL” and click on it.

You’ll be redirected to a funny looking XML document. This is confirming that you have successfully subscribed to the SNS Topic.

Everything is now in place to receive any emails that are sent to me@charlescampbell.com.

Verify Email Address with AWS SES

Head back to SES > Configuration:Verified Identifies. Follow the same steps we performed to verify the domain, however, this time select Email Address as what we want to verify. Then enter the same email you setup to receive emails earlier. For example, I entered me@charlescampbell.com.

If everything is configured correctly, you will receive the verification email to your personal inbox. The email you receive will be rather horrible to read. Look through it for a phrase like:

If you requested this verification, please go to the following URL to confirm that you are authorized to use this email address

Immediately after this, you will see the verification link. Carefully copy the link and paste the link into the browser. You will see a message like this:

The verification status at SES > Email Addresses will also say verified.

Screen shot of verified identifies that includes the new custom email

And thats it! You can now receive emails at your custom email domain and they will be forwarded to your personal email address. You can also send emails using AWS SES and they will come from your verified email address.

Send yourself an email to the custom domain email address you setup to test it out!

You’ll notice the emails are really hard to read and have a bunch of information that makes it super hard to read the content of the email. In my next tutorial article I’ll show you how to setup an AWS Lambda function in order to intercept the email and make it more readable in your email.

--

--