Skip to content
Open console

CNAME Records

A CNAME record makes one name an alias of another. A lookup for the alias returns the target’s records. Use it to point a subdomain at a hostname with an existing address, such as a load balancer or a platform-as-a-service endpoint.

FieldExampleNotes
NameblogRelative to the zone.
TypeCNAME
Contentwww.example.com.The target hostname. End it with a trailing dot.
TTL14400Seconds. Default 4 hours.

Console (zone-file view):

blog CNAME www.example.com. 14400

CLI:

zcp dns record-create --domain examplecom --name blog --type CNAME --content www.example.com.

API: POST with { "name": "blog", "type": "CNAME", "content": "www.example.com.", "ttl": 14400 }.

dig blog.example.com +short
# www.example.com.
# 203.0.113.10

The answer shows the alias, then the target’s address.

  • Not at the apex. A CNAME cannot sit at the zone root (@). The apex already has SOA and NS records, and a CNAME cannot coexist with other records at the same name. Use an A or AAAA record for the apex.
  • Alone at its name. A name with a CNAME cannot also hold an A, MX, TXT, or any other record. Pick one.
  • Trailing dot. End the target with a dot (www.example.com.) so ZCP treats it as an absolute name and does not append your zone.

See also: A and AAAA, Worked examples, Record types

Ask the ZCP docs

Type a question and pick an assistant. The assistant opens in a new tab and reads this page and the full ZCP documentation, so its answer comes from our docs.

Example questions

Ask with

Your question goes to the assistant you pick, under its own terms.