Skip to content

DNS

DigitalOcean hosts DNS for your domains for free. Point the domain’s nameservers at ns1.digitalocean.com, ns2.digitalocean.com and ns3.digitalocean.com at your registrar, then manage its records here. A domain on DigitalOcean DNS can also get Let’s Encrypt certificates for its load balancers.

example.com
nametypedatattl
@A203.0.113.101800
wwwCNAME@1800
@MXmail.example.com · priority 103600
@TXTv=spf1 include:_spf.example.com ~all3600
The records the snippets below create: the apex points at a reserved IP, www follows it, and mail goes to the mail host.
yield* DigitalOcean.Domain("Example", { name: "example.com" });
yield* DigitalOcean.DomainRecord("Apex", {
domain: "example.com",
type: "A",
name: "@",
data: ip.ip,
});
yield* DigitalOcean.DomainRecord("Www", { domain: "example.com", type: "CNAME", name: "www", data: "@" });
yield* DigitalOcean.DomainRecord("Mail", {
domain: "example.com",
type: "MX",
name: "@",
data: "mail.example.com.",
priority: 10,
});

data takes Outputs, so a record follows the Droplet, load balancer or reserved IP it points at. ttl defaults to 1800 seconds.

  • DigitalOcean DNS answers for a domain only once the registrar points it at DigitalOcean’s nameservers.