Now that we have our domain and a certificate to serve it over HTTPS, let’s associate these with our CloudFront Distribution

Add Alternate Domain for CloudFront Distribution

Head over to the details of your CloudFront Distribution and hit Edit.

Edit CloudFront Distribution screenshot

And type in your new domain name in the Alternate Domain Names (CNAMEs) field.

Set alternate domain name screenshot

Now switch the SSL Certificate to Custom SSL Certificate and select the certificate we just created from the drop down. And scroll down to the bottom and hit Yes, Edit.

Select custom SSL Certificate screenshot

Scroll down and hit Yes, Edit to save the changes.

Yes edit CloudFront changes screenshot

Next, head over to the Behaviors tab from the top.

Select Behaviors tab screenshot

And select the only one we have and hit Edit.

Edit Distribution Behavior screenshot

Then switch the Viewer Protocol Policy to Redirect HTTP to HTTPS. And scroll down to the bottom and hit Yes, Edit.

Switch Viewer Protocol Policy screenshot

Next, let’s point our domain to the CloudFront Distribution.

Point Domain to CloudFront Distribution

Head back into Route 53 and hit the Hosted Zones button. If you don’t have an existing Hosted Zone, you’ll need to create one by adding the Domain Name and selecting Public Hosted Zone as the Type.

Select Route 53 hosted zones screenshot

Select your domain from the list and hit Create Record Set in the details screen.

Select create record set screenshot

Leave the Name field empty since we are going to point our bare domain (without the www.) to our CloudFront Distribution.

Leave name field empty screenshot

And select Alias as Yes since we are going to simply point this to our CloudFront domain.

Set Alias to yes screenshot

In the Alias Target dropdown, select your CloudFront Distribution.

Select your CloudFront Distribution screenshot

Finally, hit Create to add your new record set.

Select create to add record set screenshot

Add IPv6 Support

CloudFront Distributions have IPv6 enabled by default and this means that we need to create an AAAA record as well. It is set up exactly the same way as the Alias record.

Create a new Record Set with the exact settings as before, except make sure to pick AAAA - IPv6 address as the Type.

Select AAAA IPv6 record set screenshot

And hit Create to add your AAAA record set.

It can take around an hour to update the DNS records but once it’s done, you should be able to access your app through your domain.

App live on new domain screenshot

Next up, we’ll take a quick look at ensuring that our www. domain also directs to our app.