DNS records
Being rolled out. The interface described here is the one of the next release: it may still change, and may not be enabled on your tenant yet.
A DNS record publishes a name from your zones to an address, another name, a text or
a mail server. You create it with sng dns record set or a
DNSRecord manifest; the platform checks it, then publishes it within a few minutes.
Prerequisites
- A session on your tenant (
sng tenant use acme). - The
dns:writeright to create or modify,dns:deleteto delete (managed policiesreadwrite,admin). Withreadonly, you can list and describe. - For a brought domain: a declared zone. You can create the record
before the zone: it is accepted, stays
ZoneNotOwned, then is published on its own (Published) once the zone is proven. It is only published once the zone isProvisionedorActive.
1. Create a record
NAME is relative to the zone: @ for the apex, www, a.b, *.preview, _dmarc.
Without --zone, it is your default zone <tenant>.dev.stackngo.app.
# A in the default zone: www.acme.dev.stackngo.app
sng dns record set www --type A --target 203.0.113.10 --target 203.0.113.11
# MX at the apex of a brought domain
sng dns record set @ --zone exemple.fr --type MX --target "10 mx1.mail.ovh.net" --target "20 mx2.mail.ovh.net" --ttl 3600
enregistrement www.acme.dev.stackngo.app A créé : 203.0.113.10, 203.0.113.11 (id www-a-7c2e91d4)
effectif dans quelques minutes : sng dns record describe www-a-7c2e91d4
Keep the id: it is used by describe and delete. It is derived from the zone, the name and the type.
The same MX as a manifest:
apiVersion: dns.stackngo.io/v1alpha1
kind: DNSRecord
metadata:
name: mail
spec:
zone: exemple.fr # absent: the tenant's default zone
name: "@" # apex; must be quoted in YAML
type: MX
ttl: 3600
targets: ["10 mx1.mail.ovh.net.", "20 mx2.mail.ovh.net."]
sng apply mail.yml
2. Choose the type and the targets
| Type | Target (--target, repeatable) | Rules |
|---|---|---|
A | IPv4 address | public address only |
AAAA | IPv6 address | public address only |
CNAME | hostname | a single target, never at the apex (@) |
TXT | text | 1 to 255 printable ASCII characters per target |
MX | "<priority> <host>" | priority from 0 to 65535 |
For all: 1 to 16 targets, no duplicates; TTL from 60 to 86,400 s, 300 by default. Hostnames are written in lowercase; the trailing dot is tolerated.
Refused as addresses: private (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16,
fc00::/7), shared (100.64.0.0/10), loopback, link-local (including 169.254.169.254),
multicast and unspecified.
sng dns record set db --type A --target 10.0.0.12
targets[0] : 10.0.0.12 n'est pas une adresse publique
3. Modify a record
set is idempotent: a given zone + name + type triple is updated in place, targets and
TTL replaced (not added). The message says mis à jour instead of créé.
sng dns record set www --type A --target 203.0.113.20
To change the name or the type, create the new record then delete the old one.
4. Delete a record
sng dns record delete www-a-7c2e91d4
⚠ Suppression de l'enregistrement "www-a-7c2e91d4" (tenant "acme").
Tapez « oui » pour confirmer : oui
enregistrement www-a-7c2e91d4 supprimé
The record is removed from DNS within a few minutes. From a script: --yes. A
record created by sng apply is deleted with its manifest name:
sng dns record delete mail or sng kind delete DNSRecord mail.
Verification
sng dns record describe www-a-7c2e91d4
id: www-a-7c2e91d4
fqdn: www.acme.dev.stackngo.app
zone: acme.dev.stackngo.app (zone par défaut)
name: www
type: A
ttl: 300
targets: 203.0.113.20
ready: yes
reason: Published
ready: yes and Published: the record is published; it usually responds
within a minute (dig +short www.acme.dev.stackngo.app). The other reasons:
reason | Meaning | Action |
|---|---|---|
Published | published | — |
Conflict | the name is already held by another source (see below) | free the name, or choose another one |
Reserved | name reserved for the platform | choose another name |
ZoneNotOwned | the zone is not (yet) declared and proven among your brought domains; the record is kept and published on its own as soon as it is | declare the zone, or fix zone |
ZoneNotReady | the zone is declared but not Provisioned yet; published automatically afterwards | finish the verification |
Invalid | target or name refused (the message names the field) | fix, sng apply |
Without a reason and with synced: no: the platform has not seen the record yet.
Wait a few minutes.
Conflicts
A full name belongs to the first source that publishes it: a record, or the exposure of an App. The rule, per name:
- two sources of the same type are in conflict (two
TXTon_dmarc: put both values in thetargetsof a single record); - a
CNAMEis exclusive: no other type can coexist with it; - different types (
A+TXT,A+MX) coexist without problems.
The loser switches to Conflict (message: <nom> <type> déjà publié par …) and is retried
every minute: it is published as soon as the name is freed. An App exposed on
shop.acme.dev.stackngo.app and a DNSRecord A on shop are in conflict: do not write
a record for a name served by an App.
Within your tenant, the API also refuses to declare the same name and type twice, across all
(409 enregistrement … déjà déclaré).
Going further
- Number of records: capped by the plan — 20 in
3XS, 50 in2XS, 100 inXS, 200 inM, 400 inL, 800 inXL, 1,500 in2XL, 2,000 in3XL. - Wildcard:
*(any first-level name) or*.previeware accepted; the*is only allowed at the start. - Length:
nameup to 200 characters, full name up to 253. - Machine output:
--jsononset,list,describereturns the API object (fieldsid,zone,default_zone,fqdn,ready,synced,reason,message…). - API:
setmaps toPUT /v1/dns/records(actiondns:write, resourcednsrecord/<id>).
See also
- Your default zone
- Bring a domain
- Reference:
DNSRecord,sng dns record