If you bought domain names from any provider like Godaddy, Namecheap etc, other than AWS Route53, you might have their own name server entries. Now you have your website on AWS EC2 and want the domain name bought from another provider to be mapped with the EC2 instance. This can be done in two ways.
- Mapping A record of the DNS records to EC2 IP address.
- Create a Hosted Zone in Route 53 and map the domain address. (Will cost you $0.53 /month per hosted zone)
Map a Domain Name to AWS EC2 Server
I would highly recommend the second option as the DNS servers will be AWS maintained DNS servers. The first option is pretty straight forward. In this guide, I will explain the second option for setting up the domain name for your website hosted on AWS EC2. Follow the steps carefully for setting up the domain name.
Note: Backup 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 the AWS management console.
Step 2: Under services –> Networking, find Route 53 service and navigate to the Route 53 page.
Step 3: Click “create hosted zone” option.Step 4: Click “get started” option under DNS management.
Step 5: Click “create hosted zone” option and enter your domain details. If you 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 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 short time.
Step 8: Create an A record using “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.
Leave a comment below or contact [email protected] for more help.