Custom Domain Name - AWS

A simple walkthrough to use for your website

Let's Begin

Let's setup our custom domain in AWS

Step 1:

Login to AWS

To get started with configuration, go to your Amazon Web Services login page and ‘Sign In to the Console’.

Step 2:

Certificate Manager

The next step is to find the section inside AWS called 'Certificate Manager'. This is a place where you can generate or import digital certificates. A simple way to find this in the list is to just use the search bar at the top or click CTRL+F on your keyboard and start typing "certificate", then choose Certificate Manager from the dropdown.

Step 3:

Domain Specifics

Click the 'Get Started' button and you'll then be brought to a section to enter in your domain details.

You can enter any domain or subdomain that you'd like, but if you want to use just one certificate for your whole domain, you can setup a wildcard. Simply enter a '*.' in front of your website's URL (see below). Click ‘Review and request’ followed by ‘Confirm and request’.

This will send an authorization email to the "whois@yourdomain.com".

If you have domain privacy enabled, Amazon won't be able to send the verification email to you, instead they will send it to "whois@yourdomainregistrar.com".

To bypass this, login to your registrar (where you registered your domain name) and put a temporary pause on your domain privacy. This is usually done in the domains section of your registrar.

Do this before you click 'Review and request'.

Step 4:

Verify Domain via Email

You will get an email similar to the one below. All you need to do is click the link, which will bring you to a page where you will click a button labeled "I Approve".

Once this is done, you can head back to your Certificate Manager and click refresh. You should now see a green status of Issued.

Step 5:

Add the Certificate to a CloudFront Distribution

At this point, we are ready to pick out a custom name for use on our website and add the certificate we created to CloudFront. Head on over to CloudFront and select the distribution you'd like to use, by clicking on the blue link under the 'ID' section.

Click 'Edit' located in the top left portion of the general tab.

Add your chosen custom domain (for example aws.yourdomain.com) to the 'Alternate Domain Names' section.

This is actually adding a CNAME entry to alias your custom domain with examplegarbagetext.cloudfront.net. Change the 'SSL Certificate' to 'Custom SSL Certificate' and select your certificate that we created above.

Everything else can be left as default; scroll to the bottom and choose 'Yes, Edit'.

Step 6:

Add CNAME Entry to Your Web Server

Please Note: highlight and copy to your clipboard - your cloudfront URL (the one that looks like a bunch of numbers and letters followed by .cloudfront.net). This can be found back on the general tab for your CloudFront distribution, as the 'Domain Name', located under 'SSL Certificate'.

At this time, you will need to head on over to your website hosting company, in this example it's Bluehost. What we will be doing here is creating a CNAME entry that sets up the alias we just created to be live on your website. This step requires you to leave Amazon Web Services and sort of fish around in your domain hosting configuration. Most hosting companies have a cPanel, which makes it easy to add a new DNS zone record.

What we are going to do is find the 'zone editor', usually located under either the 'domains' section or the 'dns records' section. Add a new record and make sure it's set to CNAME. 'Host Record' should be the custom name you setup over at CloudFront, but only the first portion (you can leave the .domainname.com out). TTL should be default at 14400 and 'Points To' would be what you copied to your clipboard, so simply paste it in here.

Step 7 (Optional):

Integrating with Wordpress

If you are not using Wordpress, then you are done and can use your S3 bucket as a repository for your files with the newly created URL.

I found a pretty fantastic Wordpress plugin for those who are interested. You can tie all this configuration in to your 'upload media' section, which will automatically add the CloudFront CNAME to your files.

A company called Delicious Brains makes this great plugin, it's called WP Offload S3 and it's amazing. It basically gives you full control over all the files on your website. The plugin (with the 'Assets' add-on) can also compress using gzip, making for very fast loading times, which improves SEO :)