Mapping a Domain Name (from any vendor) with AWS ec2 Instance
The scenario is like this, you have bought a domain from GoDaddy or any place and then you have instance in AWS ec2 which is running the web server. To connect the domain or the sub domain with AWS ec2 instance, please follow the followings:
Assign a Static IP to AWS ec2 Instace
ELASTIC IP:
Why we need it? Every time we start the AWS ec2 instance it re generate the public IP. so if we collect one public IP now and map it to the domain name and we restart the AWS ec2 instance, the public IP will change. So the mapping will be invalid. To solve this we need to add one elastic IP to the current instance so the IP it gives always stay mapped with the AWS ec2 despite the changing of public IP.
Now when we have got the elastic IP we can login to the domain name provider’s dashboard.
Linking of Sub-domain to Given Static Public IP
In the Dashboard of the domain name there would be one option for DNS configuration. In the DNS Configuration we can edit the domain name or sub domain name IP in such fashion where,
type = A
name = name, for example “@”
value = the elastic IP collected from AWS ec2
Give it Some Time to Process and Then Test
Some time the mapping may take some time to get reflected in internet. Wait for few hours and hit the domain name and check if you are getting the EC@ instance server linked or not. If not, please check the following,
- Your server is running into the ec2
- Server is on right port which is accessible through firewall
Conclusion
There are another way of having domain name routing to your instance. It is called Route 53, a service by AWS. I shall talk about it and comparison with the current process in another day. Give your feedback please.