How to point your Namecheap domain name to your AWS EC2 Linux instance

Namecheap is a domain registrar that lives up to its name. It gives you the opportunity to register a new domain name for just a few bucks a year. Even better, you can point that domain name to your Amazon Web Services (AWS) EC2 Linux instance.

It’s especially a good idea to use Namecheap with AWS if you’re starting a small business and don’t have a lot of cash on hand. That’s because AWS offers you a free EC2 instance for an entire year and a domain name registered with Namecheap certainly won’t break the bank. Between AWS and Namecheap, you have an excellent opportunity to prototype a web application for next to nothing in cost.

Here are the simple steps you need to follow to get your Namecheap domain name pointing to your AWS EC2 instance.

Registering your domain name

Registering a new domain name with Namecheap is easy. Just go to the website’s home page and click on the “Domains” menu item at the very top of the page. Select the “Registrations” option from the drop-down menu that appears.

namecheap-home-page

All you have to do on the new page that appears is enter your complete domain name. Namecheap will begin the registration process by checking to make sure that it isn’t taken. If it is, you’ll have to pick another name.

namecheap-domain-page

If the name hasn’t been taken, you’ll receive a pleasant message from Namecheap that your domain name is available. You’ll also see pricing options.

Once you’ve gone through the whole shopping cart process and secured your domain name, keep Namecheap open while you begin your work on AWS.

Elastic IP address

You’re going to need an Elastic IP Address to point your domain name to your EC2 instance. If you’ve just created an EC2 instance, it probably isn’t using an Elastic IP Address by default. You’ll have to configure one for your server.

Before you do that, though, check with AWS about pricing options for Elastic IP Addresses. They’re fairly inexpensive, but keep in mind that you get charged for an Elastic IP Address you’ve claimed that isn’t associated with an instance. In other words, you pay when you don’t use the Elastic IP Address.

To set up your Elastic IP Address, login to AWS and select the EC2 option from the front page. Click on the “Running Instances” link towards the top of the page and you should see a list of all your EC2 instances. Click on the instance you want to be the home for your new domain name and view the “Description” tab at the bottom of the page.

aws-running-instances

On the right-hand side of the “Description” tab, you should see an “Elastic IP” label. If you haven’t associated an Elastic IP Address with that instance, then the field will be blank.

In the far left-hand sidebar of the same page, scroll down a bit until you can see the “Network & Security” options. Underneath that header, you should see a clickable option labeled “Elastic IPs.” Click on that.

aws-elastic-ips

In the main part of the page, the table you’re looking at is probably blank. That’s because you haven’t allocated any IP addresses at this point. Begin that process by clicking on “Allocate New Address” at the top.

allocating-aws-addresses

Once you have an IP address, select “Actions” from the top of the page and then select “Associate Address” from the drop-down menu that appears. When the “Associate Address” dialog box appears, select the instance that you want to associate with your Elastic IP Address and then click on “Associate.”

Congratulations! Your AWS EC2 Linux instance now has its own IP address!

Now, it’s time to associate your new domain name with that address.

Route 53

To associate your domain name with your new IP address, you’ll have to use another great tool that’s part of AWS: Route 53.

At the very top of your AWS screen select the “Services” menu item. From the (large) menu that appears below, select “Route 53.”

aws-services-route53

When you get into the Route 53 dashboard, you’ll probably see that you have no hosted zones at this point. That’s okay, because you probably haven’t created any.

Click on “Hosted Zones” on the left-hand sidebar. Then, click on the “Create Hosted Zone” button at the top of the screen.

aws-hosted-zones

The form to create a hosted zone will appear on the right-hand side of the screen. Enter the domain name just as you registered it on Namecheap. You can enter any comments you wish in the next field, but that’s optional. Select “Public Hosted Zone” from the drop-down menu below.

Right off the bat, Route 53 will create two record sets for you: an NS record set and an SOA record set. Of particular importance to you right now is the NS record set. That’s because it lists the nameservers that you’ll need to plug into Namecheap in just a little bit. Copy and paste the nameserver entries (there should be four of them) into a text file so that you can use them later.

You’ll also need to create two additional “Type A” record sets. Click on the “Create Record Set” button at the top and you’ll see another form appear on the right-hand side of the screen. Leave the “name” field blank. For “Type,” select “A – IPv4 Address” from the option list. For “Value” enter your Elastic IP Address. Finally, click on the “Create” button.

aws-hosted-zones-create-record

When you’re done with that record set, repeat the exact same process for the second record set except put “www” in the “Name” field. That way, you’ll have a record set for your domain name in addition to your domain name with “www” in front of it. For example, if your domain name is xyz.com, you’ll be pointing both xyz.com and www.xyz.com to your EC2 instance.

Back to Namecheap

Once you’re done with that, there’s one final step to complete and you’re all set.

Go back to Namecheap. Make sure that you sign in so that you can see the domain you just bought.

In your list of domains on the dashboard (that’s what you should see as soon as you sign in), locate the domain name you want to point to your EC2 instance and click on the “Manage” button on the right-hand side.

namecheap-manage-domain

Scroll down a bit on the page that appears and you should see a section labeled “Nameservers.” In that section, you have an option to enter custom name servers. That’s where you’ll enter the four servers that you copied from Route 53 in the previous step. Start that process by selecting “Custom DNS” from the drop-down that appears at the top of that section.

namecheap-custom-dns

There are a couple of points that are important here, though. For starters, you have to enter each server on its own line. If you run out of lines, just click the “Add Nameserver” link at the bottom of the list.

Also, AWS puts periods at the end of each server name. Delete those periods when you copy and paste the name of each server into Namecheap.

Once you’re done, you’re not really done. It will take the Internet a while to “discover” where your domain name is supposed to be pointing, a concept known as DNS propagation. As a rule of thumb, it’s best to give it 24 hours. However, it usually takes much less time.

Wrapping it up

If you’re part of a cash-strapped startup that can’t afford to spend a great deal of money on a hosting solution, then consider using an AWS EC2 Linux instance with Namecheap. Remember: AWS gives you a free trial period that lasts an entire year for one instance and you can buy a Namecheap domain name for just a few dollars per year. Using Namecheap together with an AWS EC2 Linux instance is a great way to bootstrap your way to success if your startup doesn’t have a lot of cash on hand.

Photo credit: ChrisDag

16 thoughts on “How to point your Namecheap domain name to your AWS EC2 Linux instance”

  1. I see that Route 53 is not free-tier eligible. Would you know if I use it with namecheap, do I only really pay $0.50 per month, or there’s something else I should be aware of?

    Thanks,
    Pat

    1. You’ll have to contact Amazon about what you would pay, because cost structure varies from account to account.

      However, you will have the advantage of registering with Namecheap, which can be significantly less expensive that registering through Amazon.

  2. Just saying. I had installed nginx in the commandline after getting access to my instance and then had to edit the inbound rules to allow http on port 80. To get your website up and running go on the left Tab on AWS panel to “Network & Security”, then take “Actions” – “Edit inbound rules” to get the final piece.

    At the end your tutorial works great. Thank you so much!

  3. Thank you so much for posting. Been trying to complete this exact operation for two months with no success. While I’m still in the 48 hour waiting period, it definitely seems to be on the right track.

  4. Thanks a ton for this. First actionable tutorial that I found after playing around with this process for about an hour. Thanks a ton Brian!

  5. I always feel it would be a very lengthy and though job to point the website to ec2. But you gave me confidence and I did it in few minutes. Earlier I used to pay to Hosting expering guy. So it’s time to say him Bye 🙂

  6. Please let me know what is a use of CNAME, DNS Records, MX and A type entries which we created them at route53. Where will those be used? Only setting up nameserver is sufficient for it?

  7. You can even use public DNS for CNAME, but not sure which one is best practice. Actually I’m using on my own site but not using Route S3 at the moment.

  8. What if you want to use the ssl certificate issued by aws? most tutorials have you verify the domain by adding a cname record, but in order to do that you can’t use custom dns server names and have to switch to namecheaps basicDNS type. Any suggestions? Thanks! 🙂

  9. I bought a domain from Namecheap and hosted it with AWS. i have taken private email pro version from Namecheap, how to connect name cheap private email to Gmail, while AWS is hosting my domain from NameCheap.

    and how to use my private email with gmail app. how can i connect it

    and when i send mails, my mails are going to spam how to make my mail look authenticated?

Leave a Comment

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top