Point a subdomain with a CNAME record
Make a subdomain an alias of another hostname with an Edge DNS CNAME record, from Azion Console, the Azion CLI, or the API, and check the answer.
You can point a subdomain to another host with a CNAME record in Edge DNS from Azion Console, the Azion CLI, or the Azion API. The record below makes blog.example.com an alias of www.example.com, so a query for blog gets the address of www. A CNAME cannot be named @: to point the root domain, refer to Point an apex domain with ANAME instead.
Select an interface. The prerequisites and the procedure below switch with it.
Prerequisites
- A zone for your domain in Edge DNS. To create one, refer to Create, edit, or delete a zone.
- The hostname the alias points to. This example uses
www.example.com, an A record onwwwin the same zone that answers192.0.2.1. - The Edit Edge DNS permission. It requires View Edge DNS. Refer to Teams permissions.
- Access to Azion Console. To sign in, refer to Access Azion Console.
Add the CNAME record
The record name is relative to the zone: you enter blog, and Edge DNS serves it as blog.example.com. The value is the one hostname the alias points to. Replace example.com with your domain in every step.
To add the CNAME record with the Azion CLI, replace <zone-id> with the ID of your zone and run:
The command prints the ID of the record:
The zone holds the alias. Pass blog alone in --name: a name typed with the domain is served with the domain twice.
Once blog holds the CNAME, it holds no other record type: Edge DNS refuses an MX or CAA record on blog with 19018. For every CNAME rule and its error, refer to Record types.
Check the answer
Ask Azion’s nameserver directly, without your resolver’s cache. This check works before you delegate the domain to Azion.
To query ns1.aziondns.net for the alias, replace example.com with your domain:
The nameserver returns the target hostname, then the address of the target:
The target is in the same zone, so Edge DNS answers the CNAME and the A record of www in one response. A name that nobody queried before you saved it answers within seconds. A later change to the record can take a few minutes to reach every nameserver. For how answers are cached, refer to How Edge DNS works.
If the command prints nothing, refer to A new record returns NXDOMAIN.