You have a machine with a public IP and a domain bought from some registrar. What is missing is the bit in the middle: the DNS, which translates midominio.com into that IP. Route 53 is the AWS DNS, and having it there has a practical advantage: the records are managed from the same console as your machines, and services such as SES or certificates can create records for you.
This guide moves the DNS to Route 53 and points the domain and www to your server. It does not change where the domain was bought: that stays with your registrar.
Before you start: what each thing means
- Domain
- The name people type to reach your website, such as midominio.com. It is bought from a registrar.
- Registrar
- The company where you bought the domain and where it is renewed every year. It does not have to be the same one that manages the DNS.
- DNS
- The "phone book" of the internet: it translates the domain into the numeric address (IP) of your server.
- Route 53
- Amazon's DNS service.
- Hosted zone
- The "file" for your domain inside Route 53, with all its records.
- Record
- Each DNS entry: a name, a type and a value. The types that appear here: A (points to an IP), CNAME (points to another name), MX (who receives the email), TXT (verification texts), NS (which servers are in charge of the domain).
- Name servers (NS)
- The servers that answer questions about your domain. For Route 53 to be in charge, you have to set its servers at the registrar.
- TTL
- Time, in seconds, that others may remember a DNS answer before asking again. Low: changes show sooner. High: fewer queries.
- Propagation
- The time DNS changes take to reach the whole internet, because of the TTL.
- Static / Elastic IP
- A fixed internet address for your machine. Without it, the domain would point to an address that changes.
Step by step
Make sure you have an IP that does not change
Before pointing anything, the machine must have a fixed IP: a static IP in Lightsail or an Elastic IP in EC2. If you use the public IP it comes with by default, it will change when you reboot or stop it and the domain will be left pointing at nothing. Write down the IP.
Create the hosted zone in Route 53
In the Route 53 console, Hosted zones, Create hosted zone. Name:
midominio.com(without www), type public. When it is created, two records already appear: NS, with four AWS name servers, and SOA. Do not touch them. Each hosted zone has a small fixed monthly cost, even if it receives no queries.Copy the records you already have
If the domain already works with another DNS (the registrar's, for example), look at which records it has: email (MX), verifications (TXT), subdomains. Recreate them in the new zone before changing the name servers; otherwise, the moment you switch you will stop receiving email. It is the step people skip and the one that causes the most grief.
Create the A record for the domain and for www
Create record. Name empty (it is the root of the domain), type A, value the IP of your server, TTL 300. Save. Repeat with name
www, type A and the same IP; or else type CNAME with valuemidominio.com, which points to the previous record so you only have to change the IP in one place. A CNAME cannot be set at the root of the domain; that is why an A record always goes there.The TTL is how many seconds intermediate servers may keep the answer. While you are making changes, keep it low (300 seconds). Once everything is stable you can raise it to an hour or more.
Change the name servers at the registrar
Copy the four values of the NS record in your zone (they end in
awsdns-xx.com,.net,.org,.co.uk). Go into your registrar's control panel, look for Name servers or "Custom DNS" and replace whatever is there with those four. Save. From this moment the domain starts answering from Route 53; the change takes anywhere from minutes to a couple of days to reach the whole world, depending on the TTL the old NS records had.Check propagation
From your computer or from CloudShell:
nslookup midominio.com nslookup -type=NS midominio.comThe first should return your IP and the second the AWS servers. If the old ones still come up, it is a matter of waiting. Once the website loads via the domain, request or renew the HTTPS certificate, because the certificate servers will also resolve the domain through the new DNS.
What can go wrong
The domain works but email has stopped arriving
The MX records (and the verification or SPF TXT records) are missing from the new zone. Get them back from the old DNS if you can still see it, or from your email provider's documentation, and create them. In the meantime, email usually sits in a queue on the sending server for a few hours, so hurry but do not panic.
I created the zone twice
Two zones with the same name have different NS servers; the one that counts is the one set at the registrar. Delete the other so you do not pay for it and do not get confused.
I set a CNAME at the root and it will not let me
It is a DNS rule, not a Route 53 one. At the root goes an A record with the IP. If what you want to point to is an AWS service (a load balancer, CloudFront), Route 53 offers the alias record, which acts as a CNAME where one is not allowed.
I changed the IP and the website still goes to the old one
It is the TTL: intermediate servers keep the previous answer until it expires. If you had one hour, wait one hour. That is why it is a good idea to lower the TTL a few days before a planned IP change.
In Simplio
In Simplio every Route 53 domain is a card with its records in plain language: where the website points, which server receives the email, which verification texts there are. You add or change an A, CNAME, TXT or MX record in one line with help according to the type, and the records that make the domain work (NS, SOA) are protected so nobody breaks them by accident. Removing a record asks for two-factor.
The same task, in AWS and in Simplio
| In the AWS console | In Simplio | |
|---|---|---|
| Seeing where a domain points | Route 53, hosted zone, list of technical records | Domain card in plain language: the website goes to such-and-such IP, the email is received by such-and-such server |
| Changing a record | Route 53 form with type, TTL and value, no help | One line with help according to the type, and a warning if you are about to replace an existing one |
| Breaking the domain by accident | Nothing stops you deleting NS or SOA | NS and SOA protected; removing a record asks for two-factor |