Tech
Infected

Linux, OpenSource, Programming And Hacks

Dec 25, 2017

How to link a custom domain name to AWS EC2 instance

Dec 25, 2017
if you have created your Amazon AWS EC2 instance, you can now access it on the web using your given public ip or public DNS (something like ec2-54-36-73-206.us-west-2.compute.amazonaws.com), you can find these in the description of the instance.

But you need to access your website just using you own domain like example.com

Here are the steps to do so very easily:

Step 1: the Public Ip that you are given keeps on changing everytime you restart your instance. So, you need a static Ip known as Elastic IP.

I have written an article on how to setup elastic ip for ec2 instance, Its very simple. first complete those steps and come back here!

Step 2: now that you have an elastic ip for your instance you just need to point your domain name to it using the DNS console in your domain registrar's website (eg. Godaddy, NameCheap etc..)


Open up your DNS Management
and Add a new A record for the domain

In the Host name field you can give: www for a domain like www.example.com
or if want it to be just example.com then type @

for a subdomain type the subdomain name to get something like
blog.example.com or anything..


In the Ip address field type in your Elastic Ip which you created in the first step.


Click on add record Now, you may have to wait for sometime to get your domain working.

Enjoy!



No comments:

Post a Comment