A CNAME (canonical name) record says "this name is an alias; look up that other name instead". Resolvers follow it and return the target's records.
www.github.com. 3600 IN CNAME github.com.
; points to github.com
www.amazon.com. 1800 IN CNAME tp.47cf2c8c9-frontier.amazon.com.
; points to tp.47cf2c8c9-frontier.amazon.com
www.microsoft.com. 2388 IN CNAME www.microsoft.com-c-3.edgekey.net.
; points to www.microsoft.com-c-3.edgekey.net
www.apple.com. 123 IN CNAME www-apple-com.v.aaplimg.com.
; points to www-apple-com.v.aaplimg.com
CNAMEs are how most CDNs and SaaS platforms are attached: www.example.com points at a name the provider controls, and the provider can change addresses without touching your zone. A resolver that meets a CNAME restarts the query at the target, possibly through several CNAMEs, and returns the whole chain.
A CNAME replaces all other data at its name. RFC 1034 section 3.6.2 and RFC 2181 section 10.1 forbid other records alongside it (DNSSEC records excepted). Because the zone apex always has SOA and NS records, a CNAME cannot be placed there. Providers offer non-standard "ALIAS", "ANAME" or "CNAME flattening" features instead, which answer with A/AAAA records.
www.example.com. 3600 IN CNAME example.cdn-provider.net.
Wire format: RDATA is a single domain name, the canonical name, in DNS label format.
| Field | Meaning |
|---|---|
| Owner | The alias. It may hold no other records apart from DNSSEC ones. |
| Target | The canonical name. Write it fully qualified with a trailing dot in a zone file, or it is treated as relative to the zone. |
example.com). It breaks MX, NS and SOA and is rejected by most DNS hosts. Use ALIAS/flattening or A records.www CNAME cdn.example.net becomes cdn.example.net.example.com..