A CNAME (Canonical Name) record is a DNS resource record used to create an alias for a domain. It specifies that a domain name is a synonym for another, canonical domain name. Unlike A records, CNAME does not map a name directly to an IP address but redirects the DNS resolver to another host.
When a DNS server encounters a CNAME record, it stops searching for the current name and initiates a new query for the target domain. This process repeats until an A or AAAA record containing an IP address is found. A key technical restriction from RFC 1034 is that a CNAME record cannot coexist with other records for the same name, which prevents its use at the zone apex.
This record is primarily used for managing subdomains when multiple services need to point to the same infrastructure, or when integrating with CDNs and managed load balancers. It simplifies administration: if the destination server's IP address changes, only the primary domain's A record needs updating, while all aliases remain valid.
How it works
Consider configuring blog.example.com. Instead of pointing to a specific IP, a CNAME is created pointing to ghs.googlehosted.com. If the service provider changes their infrastructure IP addresses, the domain owner does not need to update their DNS settings, as the resolution chain updates automatically on the provider's side. This abstraction layer is essential for modern cloud scaling.