Key idea
Each DNS record answers one kind of question. A and AAAA point a name at an address, CNAME points it at another name, and TXT holds text that proves something about the domain. To put your own domain on a hosting platform, a subdomain almost always gets a CNAME.
The four you'll use
| Type | Its value | Use it when |
|---|---|---|
| A | An IPv4 address, like 203.0.113.10 | Your host gives you an IPv4 address |
| AAAA | An IPv6 address, like 2001:db8::10 | Your host gives you an IPv6 address; add it next to the A record |
| CNAME | Another name, like myapp.hosting.example.net | Your host gives you a hostname to point at |
| TXT | Any text | A service asks you to prove you own the domain, or for email settings |
A name can have several A records. The resolver returns all of them, and clients pick one, which spreads the load.
Why a CNAME is usually right
A CNAME says "this name is another name for that one". The resolver follows it to the target and returns the target's addresses. When the host moves your app to new addresses, it updates its own records, and your domain follows without you touching anything.
An A record can't do that. If the host changes the address, your domain points at the old one until you notice.
The bare domain can't be a CNAME
A name with a CNAME can't have any other records. The bare domain, example.com (called the apex), always carries other records, such as the ones naming its nameservers. So the apex can't be a CNAME. You have two options:
- A and AAAA records with the addresses your host gives you for the apex.
- An ALIAS, ANAME or "flattened CNAME", if your DNS host offers one. It looks like a CNAME to you, and your DNS host answers with the target's current addresses.
Choosing
app.example.comorwww.example.com: a CNAME to the hostname your host gives you.example.com: ALIAS if you have it, otherwise the A and AAAA addresses your host gives you.- A service asks for a TXT record: add it exactly as given. It proves ownership; it doesn't send any traffic.
In the Name field, most DNS hosts want only the part before your domain (app, not app.example.com), and @ for the apex.
Check yourself