Get started with DNS
Create a hosted zone, add a record, see what the zone needs at the registrar, and delete the zone again, in about ten minutes.
Replace example.com with a domain you own, and zone-id with the id of the zone you create in step 1. Nothing in this tutorial changes your registrar, so the domain keeps resolving where it does today.
Prerequisites
- Permission for
dns:CreateZone,dns:ChangeRecords,dns:CheckDelegationanddns:DeleteZone. - In the console, also
dns:ListZonesto open Hosted zones (without it the page shows an access-denied notice),dns:GetZoneto open the zone (without it the zone's page is not found) anddns:ListRecordsto see its records. - For the CLI steps, the dcloud CLI, signed in. For the API steps, an access key (see Security).
Step 1: Create a hosted zone
Hosted zones are free.
- Open Hosted zones, then choose Create hosted zone.
- For Domain, enter example.com.
- Choose Create.
The console opens the zone. The banner says "The domain is not delegated here yet.", and the header lists the Nameservers.
dcloud dns zones create --name example.comPOST /dns/api/zones
{ "name": "example.com" }The answer holds the zone's id and nameservers, the platform nameservers. If the domain, a name
above it or a name below it is already held by another organization, the create is refused with
409 (see Create a hosted zone).
Step 2: Add a record
Add an A record that answers www.example.com with a documentation address.
- On the zone's Records tab, choose Add record.
- For Name, enter www.
- For Type, keep A.
- For Values, one per line, enter
192.0.2.10. - Keep TTL (seconds) at 3600, and choose Add.
The record appears in the table, under the platform's NS row.
dcloud dns records set zone-id --name www --type A --values 192.0.2.10 --ttl 3600POST /dns/api/zones/zone-id/records
{ "name": "www", "type": "A", "values": ["192.0.2.10"], "ttl": 3600 }Step 3: Check the delegation
The zone is answered on the internet only once the registrar names the platform nameservers. Ask public resolvers where the domain points today.
- Choose the Delegation tab.
- Under Delegation check, choose Check now.
The status reads Elsewhere while your registrar names other nameservers, and Pending when
the domain has no NS records; the sentence under it says why.
dcloud dns zones check-delegation zone-idPOST /dns/api/zones/zone-id/check-delegationTo serve the domain from here, you would now set the nameservers at the registrar (see Delegate a domain). This tutorial stops before that.
Clean up
Delete the zone. Its records go with it.
- Choose the Danger zone tab, then choose Delete zone.
- In the dialog, enter the domain name and choose Delete.
The console returns to Hosted zones.
dcloud dns zones delete zone-idDELETE /dns/api/zones/zone-id