How To Migrate External Domain DNS Service to AWS Route 53
Do you have a domain name that you purchased from registrars like Namecheap, GoDaddy, Bluehost, etc. in the past that is probably not in use (inactive) and now you might be looking to host a website using it with the minimum possible cost?
If yes, then read this post because today I'm going to show you how you can use an external domain name and migrate the registrar's DNS to AWS Route 53. This process will eventually help you utilize that domain in AWS to host a simple web app or a static website for just $0.50 - $1.00 per Month.
Disclaimer: Price may vary based on your AWS services usage. A simple static website can be hosted for just $0.50 - $1.00 per month.
What is a domain name?
A domain is an easy-to-remember, user-friendly name which maps to an IP address to access a web server from the client machine. In plain English, it is a text that we type in the browser to reach any website on the internet. For example, 'google.com' is a domain name that we use to reach Google servers.
The actual IP address of a website is a complex numerical address like 35.153.63.85 which is very hard to remember but thanks to DNS or Domain Name System which help users to use domain names and can route traffic to web servers. In AWS, Route 53 is a globally distributed DNS service that translates custom human-readable domain names into IP addresses.
What is DNS?
DNS stands for Domain Name System. It's a group of globally distributed database servers that act as a "Phonebook" for the whole Internet and maps a domain name/subdomain name to the device's IP address. This group of database servers works together by delegating the request to another server to resolve the domain name to the IP address. The actual process of resolving a domain name is complex and involves querying multiple name servers but DNS also maintains a cache of widely used resolved domains at a different layer for faster discovery. I won't go into more details of how exactly it works but here is an infographic that explains the process on a high level.
Intro To AWS Route 53?
AWS Route 53 is a highly available, scalable Domain name web service. It's an AWS-managed service where you can manage all your DNS records to connect your AWS resources to domain names.
It can be used to perform three main functions -
When you register a domain name using Route 53, the service automatically provides the DNS service for your domain. The DNS service is provided by Route 53 by creating a "hosted zone" for your domain. Once it creates a hosted zone, a set of four services are assigned to your domain name and configured as Domain Name Servers.
This set of four servers is responsible to resolve the domain name, say - example.com to AWS resources like an application load balancer, S3 bucket static website endpoint, cloud front distribution endpoint, or any other AWS resource with the IP address.
Common DNS Records In Route 53
Points to Remember:
Steps to Migrate DNS From Third Party to AWS Route53
Now that you have some basic understanding of domain name and DNS and the benefits of using Route 53 as a DNS service, we can now learn how to migrate DNS service from any third-party DNS provider to Route 53. Please note that migrating DNS is relatively a simple process, but it should be done carefully to avoid any downtime to your application.
Domain registrars and DNS services both are two different things. Most domain registrars provide DNS services as an additional service along with domain registration.
Before we go into migration steps, I just want to clear up how you can get DNS services:
Scenario 1: Brand New Domain from External Registrar to Route 53
To begin the process, it is necessary to have a registered domain name that is not managed through Route 53. While you can typically register a domain name using Route 53 for a cost ranging from $9.00 to $13.00 for most top-level domains (TLDs), there are occasions when you can find the same domain names at lower prices from third-party registrars such as Namecheap. Currently, Namecheap is running a special promotion where new customers can obtain a ".COM" domain for just $5.98 by using the promo code NEWCOM598.
Therefore, if you are experimenting and require a domain name for hands-on usage in AWS, you can purchase an inexpensive domain from a registrar outside of Route 53. Later on, you can migrate the DNS to Route 53 to utilize it within your AWS Account. Let's get started.
Step 1: Domain Name
In this tutorial, I'm using one of the domains "example.com" that I had registered at Namecheap long back but never used to host any website. I will be using it for this experiment.
Step 2. Create a Hosted Zone in Amazon Route 53
Route 53 allows you to create a "Hosted Zone" which is a container where you will keep all your DNS records to define how you would like the traffic to route from the domain name and its subdomain names.
To create hosted zone:
Log in to your AWS account and click on "Services" and under "Networking and Content delivery" you will see "Route 53". Since Route 53 is a regional service, it can be accessed from any AWS region.
领英推荐
Next, click on the Hosted Zone and fill out the domain name, description, type, and Tags (optional). Since you want the domain to get the traffic from outside the VPC, select "Public hosted zone". Once you have the required information, click on "Create Hosted Zone".
As soon as you create the public hosted zone for your domain, AWS Route 53 will add 2 records to it.
FYI, With Private Hosted Zone, you can use any domain name and you don't
need to register a domain mainly because the domain is created under
the "Private Hosted Zone" and traffic is only limited to your own VPC.
If you want to read more about these records, click here.
Step 3. Update Name Servers and point them to AWS Name Servers
The final step is to update the default name servers on the domain registrar portal and point them to the AWS Route 53 public-hosted zone-provided name servers. The name servers that you see above in Figure: 5 are what you would need in this step. In my case, I bought this domain from Namecheap.com and I would go and update the name servers after logging into my user account.
Click on the dropdown and choose custom DNS and add 4 name server records from Route 53 public hosted zone.
For easy access to name server names in AWS Route 53, open the public hosted zone of the domain and click CHECK BOX in front of the NS record as shown below, and copy the value by clicking the icon highlighted in "yellow" to avoid any typo error.
As soon as you are done updating custom Name Servers, your domain will be pointed to the AWS Route 53 public hosted zone provided Name Server records.
Step 4. Verify Migration
To verify migration was performed successfully -
Scenario 2: Existing Domain from Third Party Web Host to AWS Route 53 Using DNS Zone File
If your website is currently hosted with a third-party hosting provider like HostGator or Bluehost, and you want to migrate only the DNS service to AWS Route 53 to take advantage of its benefits and ensure a seamless migration without losing any of your existing DNS records, you can make use of the existing DNS zone file from the cPanel of your current website hosting provider.
Some providers allow you to download the zone file directly from c-panel, but some might not have that option available like HostGator. If that's the case with your provider, then read the below article -
Once you have access to the DNS zone file then follow the below steps -
Next Steps:
Next, we will see how to host a public website from an S3 bucket utilizing CloudFront distribution and restricting public access to S3 origins by utilizing "Origin Access Control" settings. We will also see how to encrypt the connection between the client and the origin by enabling HTTPS using a free public SSL/TLS certificate from Amazon Certificate Manager (ACM).
Conclusion
Migrating DNS from a third-party provider to AWS Route 53 is a straightforward process, but it can be a bit confusing if you are unfamiliar with DNS services and how they are provided when you purchase a domain name. DNS is an additional service that comes bundled with a domain name or is offered by your web hosting provider, and it can be migrated. However, it is crucial to execute the migration carefully to prevent any potential downtime, especially if your website experiences high traffic.
To ensure a smooth transition, it is essential to pay close attention and ensure that all your DNS records are successfully transferred from your previous provider to AWS Route 53 before making any changes to the "Name Servers" currently associated with your domain. By taking these precautions, you can minimize the risk of disruptions and ensure a seamless DNS migration.
I hope you enjoy the read! Please let me know if you have any questions in the comments and please share your experience specifically related to downtime and disruptions during the migration process. Thank you!
Building and Managing Engineering Teams
3 个月Great article Harry S. For anyone reading this, if you copy the DNS value from Route53 and you try to update it in your domain provider's DNS record but it fails, ensure that the trailing dot(.) at the end of the DNS value is also part of the value you copied.
Profesional de Servicios y tecnologías de la información
1 年Harry S. "Hello! For Scenario 1, is the name of the hosted zone in Route 53 required to match the domain (example.com in your case)?