TLT: Associate A NameCheap Domain with an Amazon EC2 Instance

This wasn't as obvious as I wanted it to be. Since AWS and NameCheap haven't cared to document the process of associating each other, here's your "The Little Things" (TLT) guide. Well, here are my notes at least.

The Problem:

I have a domain name from NameCheap. I also have an Amazon EC2 instance running. I need the domain to point to the EC2 instance.

Jargon:

DNS - (Domain Name Server/System/Service) Some service that translates a readable domain name into a numerical address.

Static IP address - One address to rule them all. This IP doesn't change.

Elastic IP - What Amazon calls static IP addresses. It can, therefore, be reused. Stupid, yeah, I know. Elastic IPs point to your AWS account, not any particular EC2 box, which is something you should note. With this, you can avoid the usual wait involved with associating a dynamic DNS name with a new Public-facing IP address. Updating a dynamic-DNS-to-Public-IP association could prevent users from getting to your site while the IP's sync with the DNS.

Public IP address - Associated with your EC2 instance. You can associate an elastic IP with an interface, and then the interface with an EC2 instance. When/if you decide to do that, your EC2 instance's Public IP is replaced with the Elastic IP. This IP address is the address everyone will see.

Private IP address - There are IP addresses designated to exclusive areas of the internet. Private IP addresses are to users outside of a private network as Platform Nine and Three-Quarters is to a muggle -- that's what we like to assume Private IP's are by default, at least.

Network Interface - ("ENI" or "Elastic Network Interface" to Amazon) A segway between one networked entity and another or many others. AWS allows you your own private cloud called a VPC (Virtual Private Cloud). When you create an EC2 instance, a network interface is automatically created. Some kinds of EC2 instances can be assigned more network interfaces than others -- it looks like Amazon created this restriction in accordance with the size of the instance. J

The Solution:

1) Sign in to Namecheap.com and AWS.

2) In your Namecheap.com window/tab, locate your list of domains. As I'm writing this, that's located here.

3) Select the domain you want to associate your EC2 instance with. (There's a checkbox on the left of the domain name.)

4) Click "Edit Selected."

5) Click "All Host Records" located in the left panel.

6) You should see a chart with "@" and "www" in its left-most collumn. Keep this tab open and switch to your AWS tab.

7) Go to your AWS Management Console. As I'm writing this, that's located here. Click EC2.

*At this point, your EC2 instance should be running. I won't walk you through spinning one up, but if you need me to, feel free to let me know in a comment below.

8) Select the EC2 instance you want to associate with your NameCheap domain name.

9) Take note of (copy/paste somewhere) the selected instance's Public IP address and its Public DNS.

10) Click "Elastic IPs" in the left panel.

11) Click "Allocate New Address." Click "Yes, Allocate."

*In the next step, I assume there's already a network interface that was created for your EC2 instance. If not, let me know.

12) Select the Elastic IP address you just created.

13) Click "Associate Address."

14) Select your Network Interface. (It'll be listed once you click the 'Network Interface' input field.)

15) Select a private address (the one associated with your EC2 instance). Click "Associate."

16) Go to your EC2 instance in the management console. Notice a change in the Public IP address. That's good. Copy both the Public IP address and the Public DNS.

17) In your NameCheap tab, locate the input field next to the @ symbol we noticed before. Place the Public IP of your EC2 instance in that box.

18) Place the Public DNS in the input field next to 'www' in that same interface.

19) Save your changes.

Success:

Now, wait. It usually take less than 10 minutes for the association to happen. If everything was done corectly, your NameCheap domain name should point to your EC2 instance.

Questions?

If you had any problems, let me know in a comment. Incidentally, if you have a friend who's stuck trying to get his domain name to point to his/her EC2 instance, send 'em here. :)

AWS documentation sucks, by the way. Way too dense. It's hard to get something done when you have to read an entire textbook to do one small task. Get it together, Amazon.

This is all for Renee. Let's keep it going.

Greg

Software Engineer

Subscribe to GregBlogs