People type names; networks need addresses. DNS (the Domain Name System) turns one into the other. Every curl so far started with a DNS lookup you never saw.
A lookup, step by step
A resolver does the asking for you. CloudShell's is 10.0.0.2; inside a VPC it is the VPC's base address plus two (172.31.0.2 in the default VPC). It asks the root servers, which point it at the servers for .example, which point it at the domain's own name servers. Those have the answer: they are authoritative.
dig example.com;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4325
;; ANSWER SECTION:
example.com. 3600 IN A 93.184.215.14
;; SERVER: 10.0.0.2#53(10.0.0.2) (UDP)Each line of the ANSWER section is a record: name, TTL, class IN, type, value. The name ends in a dot: a fully qualified name. NOERROR means it answered; NXDOMAIN means no such name. #53 is the port DNS listens on. dig +short example.com prints only the value.
| Type | Holds |
|---|---|
| A, AAAA | an IPv4, an IPv6 address |
| CNAME | another name to look up instead |
| TXT, MX | text (proofs, policies), the mail server |
| NS, SOA | the zone's name servers, its administrative record |
TTL: answers are kept
The resolver keeps each answer for its TTL, in seconds (3600 above), and answers from memory meanwhile. A changed record can take up to the old TTL to be seen.
Registrar and DNS host
Two jobs. The registrar holds the registration and tells the registry (the operator of .example, whose servers the resolver asked second) which name servers answer for the domain. The DNS host runs those servers and keeps the records. Route 53 does both: Route 53 Domains registers, hosted zones hold records.
aws route53domains list-domainsaws route53domains get-domain-detail --domain-name monstermarket.example --query "Nameservers[].Name" --output textThe market registered monstermarket.example, but the registration still points at its old DNS host's name servers, and that host has closed: every name under the domain answers NXDOMAIN.
dig NS monstermarket.example;; ANSWER SECTION:
monstermarket.example. 172800 IN NS ns1.oldhost.example.
monstermarket.example. 172800 IN NS ns2.oldhost.example.Moving the market's DNS to Route 53 is the next lesson.