In this blog, you will learn to point domain name to ec2 instance using the step by step guides.
Map a Domain Name to AWS EC2 Server
If you bought a domain name from providers like Godaddy, Bluehost, Namecheap, etc, other than AWS Route53, you might have their own name server configured in the DNS settings.
Now that you have your website on the AWS EC2 instance, mapping the domain name to the EC2 instance can be done in two ways.
- Mapping A record of the DNS records to an EC2 IP address (ec2 elastic IP).
- Create a Hosted Zone in Route 53 and map the domain address. (Will cost you $0.53 /month per hosted zone)
Method 1: Mapping Domain Name Using A Record
The easiest option is to map a domain name to an ec2 instance is by adding the elastic IP of the instance as an A record in the DNS settings.
Here is an example of an A record-setting on Godaddy.
Method 2: Mapping Domain Name Using Route53
Follow the steps carefully for setting up the domain name using Route53.
Note: Back up your current DNS file of your domain name providers. Also, make note of any custom DNS records that points to other mail servers.
Step 1: Head over to the AWS management console.
Step 2: Under services –> Networking, find Route 53 service and navigate to the Route 53 page.
Step 3: Click the “create hosted zone” option.
Step 4: Click the “Get started” option under DNS management.
Step 5: Click the “create hosted zone” option and enter your domain details. For example, if your domain name is example.com
, provide example.com in the domain name text box. Comment is some arbitrary description for your hosted zone. Leave the “type” as “public hosted zone“
Step 6: Once the hosted zone is created, you can see four Nameserver details in the NS row as shown below.
Step 7: Replace the existing Nameserver entries in your domain name provider with the AWS NS values from your hosted zone. The DNS changes will take up to 48 hours to get propagated all over the world. Mostly you will see the changes in a short time.
Step 8: Create an A record using the “create record set” option in route53 and assign the elastic IP of your ec2 instance which hosts your website. This will point the domain name to your website.
Conclusion
In this blog, I have added two methods to point a domain name to an ec2 instance.
For the production server, make sure you add an elastic IP to the ec2 instance and use it with the domain name settings.
Leave a comment below or contact [email protected] for more help.
2 comments
Thanks a lot. The simplest way to solve my issue was to find your post and follow it. Easier than the documentation I found in AWS.
Kudos
i went to host my website using ec2 on wordpress and i have been also uploaded my html file and also change the name server yet it is not working . please help me because i am doing a ojb and my boss said to me to do that but i could not do since 15days