How Do You Use Amazon Route 53 with a Domain Name?

Problem scenario
You have a web server with an external IP address (e.g., a VPS, an EC-2 instance, a DigitalOcean droplet, a VM in Azure or GCP).  You have a domain name, e.g., funexample.com, that you have registered.  You want to go to craft a URL foobar.funexample.com to resolve to this web server with an external IP address.  Right now when you open a web browser and go to foobar.funexample.com, nothing downloads.  You get a message about "Server not found" or "Page cannot be displayed."  In a web browser when you enter the external IP address of the web server, it resolves.  How do you up DNS to resolve your URL to your IP address with Amazon Route 53?

Solution
Prerequisites

1.  You have registered a domain name with AWS or transferred a domain name to Amazon (e.g., funexample.com).  (This costs money.)
2.  You have the external IP address of a web server (e.g., x.x.x.x) that you want to assign a domain name to (e.g., you want a URL with funexample.com to resolve to x.x.x.x).

Procedures
1.  Log into the AWS Console.
2.  Go here: https://console.aws.amazon.com/route53/home#hosted-zones:
3.  Check the option near the domain you want to configure (as there should be a circular button on the left)
4.  On the right there should be a button that says "Configure Query Logging"
5.  For the "New log group name" choose something like this (but replace "contint" with a phrase that will be meaningful to you): /aws/route53/contint
6.  Click "Create Log Group"
7.  For the option "CloudWatch Logs resource policy" choose the "Create a new resource policy in..."
8.  For the field "Resource policy name", enter one that will be meaningful to use (e.g., "route-53-query-logging").
9.  For the "Log groups that the resource policy applies to" enter something like this: /aws/route53/*
10.  Click "Create policy and test permissions" button
11.  Click the button in the lower righthand corner that says "Create query logging config"
12.  Click "Go to Record Sets" button
13.  Click "Create Record Set"
14.  Enter a value for Name.  The result will be something worth noting.  For example, if you enter "foobar" your website address will be foobar.funexample.com (assuming your domainname was funexample.com).
15.  Enter the IP address of your web server in the "Value" field.  (We recommend a private or "internal" IP address.)
16.  Click the "Create" button.
17.  You are now done.  AWS servers will be able to resolve the foobar.funexample.com URL almost immediately.  From an AWS Linux server, you can run a command like this: curl foobar.funexample.com > /tmp/good.html
Then examine /tmp/good.html to verify it is the page you want.

Web browsers on a Windows workstation will need time (e.g., 30 minutes or more) for your new URL, e.g., "foobar.funexample.com", to resolve.

Leave a comment

Your email address will not be published. Required fields are marked *