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

About The Author

17 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. Required fields are marked *

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

Scroll to Top