Skip to main content
Google Cloud

Managing Workspace DNS Records in Cloud DNS: MX, SPF, DKIM, and DMARC

Host a domain in Google Cloud DNS and add Workspace records: verification, MX records, SPF, DKIM and DMARC, with gcloud commands, migration steps, and DNSSEC.

Last checked against Google's official documentation on .

Managing Workspace DNS Records in Cloud DNS: MX, SPF, DKIM, and DMARC

Every Google Workspace domain depends on a handful of DNS records: one to prove you own the domain, MX to receive mail, and SPF, DKIM, and DMARC to stop others sending as you. Many companies keep these at whatever registrar they bought the domain from, managed by whoever remembers the password. Moving them to Google Cloud DNS puts the MX records and the rest under the same access controls and audit logs as your cloud projects.

Once you use Google Cloud, it makes sense to move the domain into Cloud DNS. Records are managed with IAM roles and audit logs, changes can be scripted, and the domain sits next to the rest of your infrastructure. This guide covers the Workspace records you need, how to create them in Cloud DNS, and how to migrate without dropping a single email.

Key Takeaways

  • Cloud DNS is a managed authoritative DNS service with IAM, logging, and DNSSEC.
  • Workspace needs verification TXT, MX, SPF, DKIM, and DMARC records.
  • New setups use a single MX record: smtp.google.com, priority 1.
  • Import the full zone and compare before you change name servers.
  • Cost is low: about $0.20 per zone a month plus queries.

Table of contents

Open Table of contents

The Cloud DNS Records Workspace Needs

The DNS records behind Google Workspace email

PurposeTypeNameValue
Domain verificationTXT@google-site-verification=... (from the Admin console)
Receive mailMX@1 smtp.google.com.
Authorize sendersTXT@v=spf1 include:_spf.google.com ~all
Sign outgoing mailTXTgoogle._domainkeyv=DKIM1; k=rsa; p=... (from the Admin console)
Policy and reportsTXT_dmarcv=DMARC1; p=none; rua=mailto:dmarc@yourcompany.in

Add other senders, such as a marketing platform or ticketing system, to the same SPF record rather than creating a second one. Our email authentication guide explains how to roll DMARC from p=none to p=reject safely.

Create the Zone

In the Cloud console, open Network services > Cloud DNS and create a public zone for your domain. Or with gcloud:

gcloud dns managed-zones create yourcompany-in \
  --dns-name="yourcompany.in." \
  --description="Company domain" \
  --visibility=public

Cloud DNS assigns four name servers to the zone. You will give these to your registrar at the end.

Put the zone in a dedicated project in your Shared services folder, and grant the DNS Administrator role only to the group that manages DNS. Everyone else can have DNS Reader.

Add the Workspace Records

Use a transaction or individual record commands. For example:

gcloud dns record-sets create yourcompany.in. --zone=yourcompany-in \
  --type=MX --ttl=3600 --rrdatas="1 smtp.google.com."

gcloud dns record-sets create yourcompany.in. --zone=yourcompany-in \
  --type=TXT --ttl=3600 \
  --rrdatas='"v=spf1 include:_spf.google.com ~all"','"google-site-verification=abc123"'

gcloud dns record-sets create _dmarc.yourcompany.in. --zone=yourcompany-in \
  --type=TXT --ttl=3600 \
  --rrdatas='"v=DMARC1; p=none; rua=mailto:dmarc@yourcompany.in"'

Note that all TXT values at the root (@) live in one record set with several values. Creating a second TXT record set at the same name fails.

The long DKIM key

Generate the DKIM key in the Admin console under Apps > Google Workspace > Gmail > Authenticate email, choosing 2048 bits. The key is longer than the 255-character limit for one TXT string, so split it into quoted chunks:

gcloud dns record-sets create google._domainkey.yourcompany.in. \
  --zone=yourcompany-in --type=TXT --ttl=3600 \
  --rrdatas='"v=DKIM1; k=rsa; p=MIIBIjANBgkqh...first-part" "second-part...IDAQAB"'

Then return to the Admin console and click Start authentication.

Optional: MTA-STS and TLS reporting

MTA-STS tells other mail servers to deliver to your domain only over authenticated, encrypted TLS, and TLS reporting sends you reports about delivery problems. Besides the mta-sts.txt policy file you publish on a web server, Google’s setup needs two TXT records, which fit naturally in the same Cloud DNS zone:

gcloud dns record-sets create _mta-sts.yourcompany.in. --zone=yourcompany-in \
  --type=TXT --ttl=3600 --rrdatas='"v=STSv1; id=20261126000000"'

gcloud dns record-sets create _smtp._tls.yourcompany.in. --zone=yourcompany-in \
  --type=TXT --ttl=3600 --rrdatas='"v=TLSRPTv1; rua=mailto:tlsrpt@yourcompany.in"'

The id must be 1 to 32 letters and numbers, and you change it to a new value every time the policy changes. Our email authentication guide covers the policy file, testing mode and BIMI.

Migrating an Existing Domain

The goal is to change name servers with every record already in place, so nothing breaks.

  1. Lower TTLs at your current provider to 300 seconds, a day before.

  2. Export the zone from the current provider as a BIND zone file if it allows it. If not, copy every record by hand.

  3. Import it into Cloud DNS:

    gcloud dns record-sets import zone.txt --zone=yourcompany-in \
      --zone-file-format
  4. Compare records. Query Cloud DNS’s name servers directly for MX, TXT, and every CNAME (for example dig MX yourcompany.in @ns-cloud-a1.googledomains.com) and check them against the old provider.

  5. Handle DNSSEC. If the old provider had DNSSEC on, remove the DS record at the registrar and wait for it to expire before switching.

  6. Change name servers at your registrar to the four Cloud DNS servers.

  7. Watch mail flow for 48 hours with the Admin console’s email log search, and check DMARC reports.

Do not forget records that are easy to miss: subdomains for websites, CNAMEs for SaaS tools, SRV records, and any old verification records still in use.

Turn On DNSSEC

DNSSEC signs your records so resolvers can detect forged answers. In Cloud DNS, enable it on the zone, copy the DS record it generates, and add that at your registrar. Not every registrar supports DS records for every domain extension, so check first.

Pricing

Google’s pricing page shows Cloud DNS is charged per zone and per query:

ItemPrice
Managed zones 1 to 25about $0.20 per zone per month
Managed zones 26 to 10,000about $0.10 per zone per month
Queries, first 1 billion a month$0.40 per million

There is no free tier, but a typical company domain costs well under a dollar a month.

Common Mistakes

  • Two SPF records at the root, which makes SPF fail.
  • Missing trailing dots on MX and CNAME targets in zone files.
  • Switching name servers before copying every record, which breaks websites or SaaS tools.
  • Forgetting the old DNSSEC DS record, which makes the whole domain fail validation.
  • Granting DNS Administrator to the whole IT team, when one wrong edit can stop email.

Verifying Records After Changes

After any DNS change, check the live answers rather than trusting the console. These commands query public resolvers:

dig +short MX yourcompany.in
dig +short TXT yourcompany.in
dig +short TXT google._domainkey.yourcompany.in
dig +short TXT _dmarc.yourcompany.in
dig +short NS yourcompany.in

Then confirm with Google’s own tools:

  • The Admin console shows whether Gmail is activated and DKIM authentication is on.
  • Google Admin Toolbox Check MX tests MX, SPF, DKIM, and DMARC for common errors.
  • DMARC aggregate reports confirm that legitimate mail passes after the move.

Troubleshooting

Mail bounces after switching name servers. An MX record was missed or mistyped. Compare against the old zone and check for a missing trailing dot in any zone file you imported.

SPF fails for a marketing tool. The tool’s include was not copied into the single SPF record, or the record now exceeds the limit of 10 DNS lookups. Remove unused includes.

DKIM shows “not authenticating” in the Admin console. The TXT record is split incorrectly or contains extra spaces. Re-enter it as quoted chunks with no line breaks inside the key.

The domain fails to resolve at all. DNSSEC is still configured at the registrar with the old provider’s DS record. Remove it, or replace it with the DS record from Cloud DNS.

Changes do not appear. Resolvers cache old answers until the TTL expires. This is why lowering TTLs before a migration matters.

Private Zones and Split-Horizon DNS

Cloud DNS also hosts private zones, visible only to the VPC networks you choose. They are useful for internal names such as db.internal.yourcompany.in that should never be published.

You can even create a private zone with the same name as your public domain. VMs in the authorized networks then get internal answers while the internet gets public ones. This is called split-horizon DNS, and it is handy for routing internal traffic to private IP addresses.

Two related features complete the picture:

  • Forwarding zones send queries for an on-premises domain, such as corp.local, to your office DNS servers over VPN.
  • Inbound server policies let on-premises systems resolve Cloud private zones.

DNS Change Control

Email is too important to break with an unreviewed DNS edit. A light process is enough:

  1. Keep the zone in infrastructure as code or at least export it to a file in version control after each change.
  2. Require a second person to review changes to MX, SPF, DKIM, and DMARC records.
  3. Make changes during working hours, never late on a Friday.
  4. Check Cloud Audit Logs for DNS changes weekly, or alert on them.

Conclusion

Moving your domain to Cloud DNS puts your most critical records under the same access control and audit trail as the rest of Google Cloud. Plan the migration, copy everything, compare, and only then switch name servers.

For a new Google Workspace setup, create the zone first and add the verification, MX, SPF, DKIM, and DMARC records on day one. Tomorrow’s guide covers VPC networking for admins.


Official Google documentation:

Related reading:

This guide contains referral or affiliate links. If you sign up through one, Workspace Blog may earn a commission at no extra cost to you. Read our referral and advertising disclosure.

Frequently Asked Questions

What MX record does Google Workspace need?
For new setups, Google's MX setup instructions use a single MX record pointing to smtp.google.com with priority 1. Older setups with the five aspmx records continue to work, but you can move to the single record when you next review DNS.
How much does Cloud DNS cost?
Google's Cloud DNS pricing page lists about $0.20 per managed zone per month for the first 25 zones, $0.10 per zone after that, and $0.40 per million queries for the first billion. There is no free tier for Cloud DNS, but for a single company domain the cost is usually well under a dollar a month.
How do I add a long DKIM key in Cloud DNS?
A 2048-bit DKIM key is longer than the 255-character limit for a single TXT string. In Cloud DNS, enter it as several quoted strings in the same record. DNS clients join them back into one value.
Will moving DNS to Cloud DNS interrupt Workspace email?
Not if you copy every record first and verify them before changing name servers. Lower TTLs a day in advance, import the full zone into Cloud DNS, compare the records, then update the name servers at your registrar. Mail keeps flowing because the MX values do not change.
Should I enable DNSSEC in Cloud DNS?
DNSSEC protects your domain against spoofed DNS answers and is worth enabling for public zones. Turn it on in Cloud DNS, then add the DS record at your registrar. If your old DNS provider had DNSSEC enabled, remove the old DS record before switching name servers.