Cloud DNS in Google Cloud

Cloud DNS in Google Cloud

A plain-English guide to Google's managed Domain Name System service. Learn how names become addresses, how public and private zones work, how to connect your office network, and how to avoid the small DNS mistakes that cause very large outages.

When you type a website name into your browser, you never type a number. You type something friendly, such as a shop’s name followed by dot com. Yet the machines that run websites find each other using long numeric addresses. Something must translate the friendly name into the number, and it must do so in a few thousandths of a second, billions of times a day, without ever making a mistake. That something is the Domain Name System, usually called DNS.

Cloud DNS is Google Cloud’s managed service for running DNS. You tell it which names should lead to which addresses, and Google answers the world’s questions about those names from a huge network of servers placed in many countries. You do not install DNS software, patch a server or worry about a name server running out of memory during a traffic spike. In this guide you will learn what Cloud DNS is, how DNS works inside it, how public and private zones differ, how to connect your own offices and data centres, and how to keep your names safe and your outages rare.

Every new word is explained the first time it appears. You do not need any networking background before you begin. By the end, you will be able to explain DNS to a teammate, set up a clean design for a company, and avoid mistakes that regularly take well-known websites offline.

AWhat Is Cloud DNS?

Start with the big picture: what Cloud DNS does, and what it does not do.

DNS, short for Domain Name System, is the internet’s phone book. It stores the link between a human-friendly domain name, such as a company’s website name, and the technical details that computers need, such as an IP address. An IP address is the numeric label that identifies a machine on a network, much like a phone number identifies a phone.

Cloud DNS is a managed, authoritative DNS service. The word authoritative is important. It means that Cloud DNS holds the official, final answers for the names you place in it. When another DNS server in the world wants to know where your website lives, it ends up asking a Cloud DNS server, and Cloud DNS replies with the answer that you configured.

Analogy

Think of a very large national directory enquiry service. Millions of callers ask for a person’s phone number every minute. Somewhere there must be a master list that the operators trust. Cloud DNS is the master list for your names, kept by Google, copied to many offices around the world so any caller can be answered quickly from nearby.

Three jobs in one product

Cloud DNS does three related jobs. First, it hosts your public zones, so the whole internet can find your websites and services. Second, it hosts private zones, so only your own virtual networks inside Google Cloud can resolve your internal names, such as the name of a database used by your applications. Third, it offers forwarding and peering features, so you can connect Google Cloud with your office or data-centre DNS and share names across many projects.

Public
names visible to the whole internet
Private
names visible only inside your networks
Hybrid
names shared with on-premises systems

What Cloud DNS is not

Cloud DNS does not sell or register domain names. A registrar is the company that registers a domain name for you and records you as its owner. Google offers a separate product for that, called Cloud Domains, and many other companies are registrars too. Cloud DNS also does not route your web traffic or balance load. It only answers the question “which address should I use for this name?” The actual traffic then flows to that address, perhaps a load balancer, a web server or a storage bucket.

i
Good to know

Google has said that Cloud DNS runs on the same global infrastructure that serves Google’s own names. Google also publishes a very strong availability promise for the service. Read the current service level agreement to see exactly what is promised and under which conditions.

BThe Problem Cloud DNS Solves

To understand any tool, first feel the pain it was built to remove.

In the early days of the internet, the phone book was a single text file. Every computer kept a copy, and the file listed every machine name and its address. When a new machine joined, someone updated the master file and everybody downloaded it. This worked when there were a few hundred machines. It collapsed completely once there were millions. DNS was invented to replace the single file with a worldwide, shared, hierarchical system, where responsibility is divided among many organisations.

Running your own part of this system, however, has always been harder than it looks. A company that runs its own DNS servers must buy hardware, install software, keep it patched, place servers in at least two locations, and protect them from attackers. A DNS server that fails or slows down makes every website, app and email service behind it unreachable, even though those services are perfectly healthy. Many famous outages have been caused by DNS trouble rather than by the services themselves.

Analogy

It is like a city whose street signs all disappear overnight. The shops, the roads and the houses are all fine, but nobody can find anything. DNS is the street-sign system of the internet, and it is the first thing that must keep working.

The four big headaches

Availability

DNS must never go down

Everything depends on it. A single server or single location is a risk that few businesses can accept.

Speed

Answers must be fast

Every page load starts with name lookups. Slow answers make every site feel slow, and users are far away from your servers.

Attacks

DNS is a target

Floods of fake queries can overwhelm small servers, and forged answers can send people to criminals.

Operations

Cloud networks need private names

Applications inside a cloud need to find databases and services by name, and hybrid companies must share names with office networks.

Cloud DNS attacks these problems directly. Your zones are served from many locations at once, using a technique called anycast, so each user is answered by a nearby server. Google absorbs query floods with its huge capacity. Changes made through the console or interface spread to the serving servers without you managing any machine. Private zones and forwarding give cloud and office networks a shared naming system.

?
The trade-off

The service is simple on purpose. It answers authoritative questions very well, but it is not a full “do everything” DNS suite. If you need highly unusual DNS software features, you may still run your own servers. Later chapters help you decide.

CCore Concepts You Must Know

A handful of words explain almost everything in DNS. Learn them well and the rest becomes easy.

Domain, subdomain and the hierarchy

A domain name is read from right to left. The last part, such as com or org, is the top-level domain. To its left is the name a company registers, such as its brand. To the left of that you can add subdomains of your own, such as www or shop or api. The whole structure forms a tree, with the unseen root at the top. Each level is managed by a different organisation, and each knows only how to point to the next level down.

Analogy

A domain name is like a postal address read backwards: country first, then city, then street, then house. The post office for the country does not know every house. It only knows which city office to ask. DNS works the same way, level by level.

Zone

A zone is a portion of the DNS tree that one organisation manages as a single unit, together with all the records inside it. In Cloud DNS, a managed zone is the container in which you store the records for one domain, such as everything under your brand name. Each managed zone has a set of Google-run name servers assigned to it.

Resource record and record set

A resource record is a single entry in the zone, saying something like “the name www points to this address”. Records of the same name and type are grouped into a record set. For example, if your website has three server addresses, the three entries for the same name form one record set. The word type tells what kind of information the record holds, as the records chapter explains.

TTL

TTL stands for time to live. It is a number of seconds that tells other DNS servers how long they may remember an answer before asking again. A long TTL, such as a day, reduces load and speeds up lookups, but changes take a long time to be noticed everywhere. A short TTL, such as one minute, makes changes spread fast but increases the number of questions. Choosing TTLs wisely is one of the most practical skills in DNS.

Name server, resolver and the two kinds of DNS server

Authoritative

Authoritative name server

Holds the official records for a zone and gives final answers. Cloud DNS is this kind.

Recursive

Recursive resolver

Works on behalf of users. It asks around the DNS tree, collects the answer and remembers it for a while. Internet providers and public resolvers do this.

Stub

Stub resolver

The small piece of software inside your phone or computer that simply asks the recursive resolver for help.

Registrar

Registrar

The company where you register the domain, and where you tell the world which name servers are in charge of it.

Analogy

You are a traveller who needs a phone number. The stub resolver is you, asking your hotel receptionist. The receptionist is the recursive resolver, who calls enquiry lines until finding the answer and notes it down for the next guest. The enquiry line that finally holds the official list is the authoritative name server.

The delegation link

For the world to find your Cloud DNS zone, you must tell the parent level, through your registrar, that your zone is served by the name servers Google gave you. This link is called delegation. It is done by setting NS records at the registrar. If you create a perfect zone in Cloud DNS but never update the registrar, nobody on the internet will ever ask Cloud DNS about it. This is the single most common beginner stumble.

!
Watch out

Creating a zone and delegating to it are two different steps. The zone works only after the registrar’s name server settings point to the Cloud DNS name servers that were assigned to that zone. Always test with an outside lookup after delegation.

DZone Types: Choosing the Right One

Cloud DNS offers several kinds of zones. Picking the right kind for each need is the first real design decision.

The names and options of zone types evolve as Google adds features, so confirm the current list in the official documentation. The following types are the core ones that every beginner should know.

Public

Public zone

Holds records that anyone on the internet can look up. Use it for your websites, APIs and email settings. You must delegate to it from your registrar.

Private

Private zone

Holds records visible only to the virtual networks you choose. Use it for internal names such as a database or a back-end service. Outsiders cannot see these names.

Forwarding

Forwarding zone

Sends questions for a chosen domain to DNS servers you name, usually servers in your office or data centre. It lets cloud machines resolve on-premises names.

Peering

Peering zone

Lets one network borrow the DNS view of another network. It is the tidy way to share private zones across many projects.

Reverse

Reverse lookup zone

Answers the opposite question: which name belongs to this address? Used for logging, security tools and some email checks.

Discovery

Service Directory zone

Publishes names registered in Service Directory, so applications can find services by name without a separate DNS setup.

Analogy

Think of a company with several phone directories. The public directory is printed for customers. The private directory is the staff list inside the building. The forwarding page says “for the head office, ask their own switchboard”. The peering page says “use the other branch’s directory”. Each directory serves a different reader.

flowchart TD
  Q1{"Must the whole internet resolve this name?"}
  Q1 -- "Yes" --> PUB["Public zone, then delegate at the registrar"]
  Q1 -- "No" --> Q2{"Are the answers hosted in Cloud DNS?"}
  Q2 -- "Yes" --> Q3{"Is another project owning the private zone?"}
  Q3 -- "Yes" --> PEER["Peering zone to the owner's network"]
  Q3 -- "No" --> PRIV["Private zone attached to your networks"]
  Q2 -- "No" --> Q4{"Do on-premises DNS servers hold the answers?"}
  Q4 -- "Yes" --> FWD["Forwarding zone to those servers"]
  Q4 -- "No" --> SD["Service Directory zone or other source"]
    
Figure 1: A simple path for choosing a zone type.

Split-horizon: one name, two answers

Sometimes you want the same name to give different answers depending on who asks. Visitors on the internet should reach a public web address, while your own staff inside the cloud network should reach a private internal address for the same name. You do this by creating a public zone and a private zone for the same domain. Machines inside the chosen networks see the private answers first, while the rest of the world sees the public ones. This arrangement is called split-horizon DNS.

!
Split-horizon trap

When a private zone covers a name, the machines in that network see only the private zone for that name. If a record exists in the public zone but is missing from the private one, internal machines may not find it. Keep the two zones consistent for any name that both sides need.

EArchitecture and Components

Let us look at the main pieces that sit between a user’s question and your answer.

Cloud DNS has a control side, where you create zones and records, and a serving side, where Google’s servers answer questions. They are separate on purpose, so that busy question traffic never stops you from managing your data, and managing your data never slows down the questions. The diagram shows the typical public lookup path.

flowchart LR
  U["User Device"] --> RR["Recursive Resolver"]
  RR --> ROOT["Root and TLD Servers"]
  ROOT --> NS["Cloud DNS Anycast Name Servers"]
  NS --> ZS[("Zone Data Store")]
  ADM["Admin using Console, API or Terraform"] --> CP["Cloud DNS Control Plane"]
  CP --> ZS
  CP --> LOG["Cloud Logging and Audit Logs"]
  NS --> MON["Cloud Monitoring Metrics"]
    
Figure 2: The serving path for questions and the control path for changes.

Walking through the diagram

A user’s device asks a recursive resolver for a name. The resolver consults the root and top-level domain servers, which point it to the name servers listed for your domain at your registrar. Those listed servers are the Cloud DNS anycast name servers. With anycast, the same address is advertised from many places in the world, and the network automatically delivers each question to the nearest one. The nearest server reads the zone data and replies.

On the control side, an administrator uses the console, the command line, the programming interface or an infrastructure tool such as Terraform. Requests go to the control plane, which checks permissions, validates the change, stores it and distributes it to the serving servers. Every change is recorded in audit logs, and query activity can be measured through metrics and logs.

Analogy

Imagine a newspaper. The editorial office (control plane) writes and approves the content. The printing presses in many cities (anycast name servers) produce copies for local readers. Editors can change tomorrow’s edition without stopping today’s printing.

Key components in plain words

Serving

Anycast name servers

The global fleet that answers questions from nearby locations, with large spare capacity.

Control

Control plane

The management layer that accepts changes, checks permissions and publishes zone updates.

Data

Managed zones

Containers that hold all records for a domain, with their own assigned name servers.

Private

VPC resolver path

The built-in resolver inside Google Cloud networks that reads private zones, forwarding rules and policies.

Security

DNSSEC signing

An optional feature that digitally signs public answers so they cannot be forged on the way.

Ops

Logging and monitoring

Audit records of changes, query logs where enabled, and metrics for query volume and errors.

An important design idea hides in this picture: the data you manage is small and rarely changes, but the questions are huge in number and must be answered in milliseconds. Cloud DNS therefore copies your zone data to every serving location, so that each answer is a quick local lookup instead of a long trip.

FInternal Working: The Life of a DNS Query

Follow one single lookup from a browser to an answer and back.

Let us trace what happens when a visitor opens a web page whose name lives in a Cloud DNS public zone. The goal is to see where the time is spent, where answers are remembered and where things can go wrong.

sequenceDiagram
  participant B as Browser and Stub Resolver
  participant R as Recursive Resolver
  participant Root as Root Server
  participant TLD as TLD Server
  participant C as Cloud DNS Name Server
  B->>R: Where is www.example.com
  R->>R: Check cache, no fresh answer
  R->>Root: Who handles com
  Root-->>R: Ask the com servers
  R->>TLD: Who handles example.com
  TLD-->>R: Ask the Cloud DNS name servers
  R->>C: What is the address of www.example.com
  C-->>R: Address and TTL
  R-->>B: Address
  R->>R: Store answer for the TTL
    
Figure 3: A full lookup when nothing is cached. Most real lookups are answered from a cache.

Step by step

1

The browser checks its own memory

The browser and the operating system keep a small cache of recent answers. If the name is there and fresh, no network question is needed at all.

2

The recursive resolver is asked

The stub resolver sends the question to the resolver set by the network, often run by the internet provider or a public service. The resolver checks its larger cache.

3

The resolver walks the tree

If nothing is cached, it asks a root server, which points to the top-level domain servers, which point to the name servers for your domain, as set at your registrar.

4

Cloud DNS answers

The nearest Cloud DNS server finds the matching record set and replies with the data and a TTL. The answer is signed if DNSSEC is enabled.

5

The answer is cached and used

The resolver stores the answer for the TTL and passes it to the browser, which connects to the returned address. Later users of the same resolver get the answer instantly.

Why caching is everything

If every lookup went all the way to the authoritative server, the internet would melt. Caching is what makes DNS scale. A busy internet provider’s resolver might serve a popular name to a million customers while asking Cloud DNS only once every few minutes. This means that the number of queries Cloud DNS receives depends strongly on your TTL values and on how many different resolvers are asking.

Analogy

A caching resolver is like a shopkeeper who writes down a number the first time a customer asks for it, and uses the note for the next hour instead of phoning enquiries every time. The TTL is the shopkeeper’s rule about how long a note may be trusted.

Negative answers are cached too

When a name does not exist, the authoritative server says so, and resolvers remember that “no such name” answer for a period too, controlled by a value in the zone’s start-of-authority record. This is why a record that you create right after someone looked for it may not appear immediately for them. The earlier “not found” answer is still being remembered.

!
Why changes feel slow

Cloud DNS publishes your change quickly, but the world’s resolvers keep old answers until their TTLs expire. When people say DNS “takes time to propagate”, they really mean that old cached answers must expire. You cannot force other people’s caches to forget.

A few protocol details worth knowing

DNS questions usually travel over a lightweight transport called UDP, which sends a single small message and expects a single small reply, with no long conversation. When an answer is too large to fit, for example when DNSSEC signatures make it bigger, the resolver repeats the question over TCP, a transport that handles bigger, more careful exchanges. This is why firewalls must allow DNS on both transports, and why blocking TCP for DNS can cause strange failures that appear only for large answers.

Another detail is the response code, a short status in every answer. A normal success is called NOERROR. A name that does not exist is NXDOMAIN. A server that could not complete the job returns SERVFAIL, and a server that refuses to answer returns REFUSED. Learning these four codes helps you read monitoring graphs and tool output quickly, because they tell you whether the problem is a missing record or a broken path.

NOERROR

Success

The name exists and the answer was found. A name can exist and still hold no record of the type you asked for.

NXDOMAIN

No such name

The name does not exist at all. Typos and removed records produce this answer.

SERVFAIL

Server failed

Something broke while resolving, such as a broken forwarding path or a failed signature check.

REFUSED

Request refused

The server will not answer, often because the question came from a source that is not allowed.

Analogy

Response codes are like the replies of an enquiry desk. “Here is the number” is success. “We have no such person” is a missing name. “Our computer is down, try later” is a server failure. “We cannot give that information to you” is a refusal. Each reply tells you a different thing to fix.

GRecord Types: What Can a Name Point To?

A name can point to many kinds of things. Each kind has its own record type.

A record’s type tells resolvers what kind of data to expect. Here are the types that nearly every team uses, explained in simple words. Cloud DNS supports these and more, so check the current list when you need something unusual.

TypeWhat it holdsEveryday use
AAn IPv4 addressPoint a name to a server or load balancer
AAAAAn IPv6 addressThe same as A, for the newer address format
CNAMEAnother name, an aliasMake one name follow another
MXA mail server name and priorityTell the world where to deliver email
TXTFree textProve domain ownership, set email security rules
NSA name server nameSay which servers are in charge, or delegate a subdomain
SOAZone administration detailsHold zone settings such as the negative-answer cache time
SRVHost and port of a serviceLet applications discover where a service runs
PTRA name for an addressReverse lookups from address to name
CAAWhich authorities may issue certificatesReduce the chance of fake security certificates
Analogy

Think of a contact card with different fields. One field holds a phone number (A), another holds a nickname that redirects to a different card (CNAME), another says where to send post (MX), and another holds notes (TXT). The card is the name, and each field is a record type.

A and AAAA records

These are the workhorses. An A record links a name to an IPv4 address, the older and most common address style. An AAAA record does the same for IPv6, the newer style with a vastly larger number of addresses. Many sites publish both, so devices on either kind of network can connect. A record set may hold several addresses, and resolvers return them in a rotating order, spreading visitors a little across the servers.

CNAME records and their rules

A CNAME is an alias. It says “this name is another name for that name”. When a resolver finds a CNAME, it simply repeats the question for the target name. CNAMEs are handy, for example to point a friendly name at a service provider’s long technical name that the provider may change. But they have strict rules. A name that has a CNAME cannot hold any other record types. And the very top of a zone, called the apex or root of the domain, cannot be a CNAME, because it must hold other required records such as NS and SOA.

!
Apex rule

You cannot put a CNAME at the bare domain name. For the apex, use A or AAAA records that point to addresses. Some providers offer special alias features to work around this, so check what your target service recommends.

MX and TXT for email

Email depends heavily on DNS. MX records list the mail servers that accept email for your domain, each with a priority number, where the lowest number is tried first. TXT records carry the text rules that fight spam and forgery, which are written in standard formats such as SPF, DKIM and DMARC. Getting these records right protects your domain from being used by scammers and helps your genuine emails reach the inbox.

NS and delegating a subdomain

Inside a zone, NS records can hand a subdomain over to another set of name servers. A large company might keep its main zone in one team’s hands and delegate the subdomain used by another team to a separate zone, so that each team manages its own records. This is called subdomain delegation. It keeps responsibilities clear and limits the damage of mistakes.

CAA, SRV and PTR

CAA

Certificate authority authorisation

Lists which companies may issue security certificates for your domain. Any other issuer should refuse, which cuts the risk of fake certificates.

SRV

Service location

Gives the host, port, priority and weight of a service, so clients can find it without a fixed address.

PTR

Reverse pointer

Maps an address back to a name. Mail servers and security tools often check it.

TTL

Time to live on every set

Each record set carries its own TTL, so you can tune stable names long and changing names short.

i
Name with a trailing dot

In DNS tools you will often see names ending in a dot, such as a name followed by a final dot. The final dot means the name is complete, all the way to the root, with nothing to be added. Many Cloud DNS fields expect this fully qualified form.

HRouting Policies: Steering Traffic with DNS

DNS can do more than give one fixed answer. It can choose the answer based on weight, location or health.

Normally a record set always returns the same data. With routing policies, Cloud DNS can pick different answers for different situations. The names and exact options are updated over time, so confirm the current list in the documentation. The three ideas below are the foundation.

Weighted

Weighted round robin

You give each answer a weight. A weight of ninety and a weight of ten send roughly nine tenths of users to the first answer and one tenth to the second. It is useful for gradual rollouts of a new version.

Location

Geolocation

Answers depend on where the question appears to come from. Users in Asia can be sent to servers in Asia, and users in Europe to servers in Europe, which reduces delay.

Health

Failover

A primary answer is used while it is healthy. If health checks fail, traffic moves to a backup answer. It adds a safety net against regional problems.

Analogy

Think of a receptionist who answers the question “where is the nearest branch?” Weighted routing is like saying “send nine out of ten visitors to the big shop and one to the new shop”. Geolocation is like pointing each visitor to the branch in their own city. Failover is like saying “if the main shop is closed today, send everyone to the second one”.

flowchart TD
  Q["Question for shop.example.com"] --> P{"Routing policy type"}
  P -- "Weighted" --> W["Pick answer by weight: 90 percent primary, 10 percent canary"]
  P -- "Geolocation" --> G["Pick answer closest to the asking location"]
  P -- "Failover" --> H{"Is the primary healthy?"}
  H -- "Yes" --> PR["Return primary address"]
  H -- "No" --> BK["Return backup address"]
  W --> ANS["Answer with a short TTL"]
  G --> ANS
  PR --> ANS
  BK --> ANS
    
Figure 4: How a routing policy chooses among several possible answers.

Health checks and failover

Failover policies rely on health checks, which are regular tests that ask a service “are you working?”. When the tests show a failure, Cloud DNS stops returning the unhealthy answer and returns the backup instead. Support for health checks depends on the kind of target, such as certain internal load balancers, so read the current documentation to learn which targets can be monitored this way. Keep in mind that failover through DNS is never instant, because resolvers keep old answers until their TTLs run out.

Choosing a TTL for steering

Routing policies work best with short TTLs, perhaps thirty to a few hundred seconds, so that changes of answer reach users within minutes. The price is a larger number of queries, and a slightly higher bill and load. For failover, a TTL of around one minute is a common balance. For stable names that never change, long TTLs are better.

The honest limits of DNS steering

  • Resolvers are not users. Geolocation sees the location of the resolver, or sometimes a hint about the user’s network. A user who uses a distant public resolver may be treated as if they were far away.
  • Caches delay changes. A few resolvers and applications ignore short TTLs or keep answers longer than they should, so some users linger on old answers.
  • Weights are averages. A weight of ten percent is reached across many lookups, not each user’s next request. With few users, the split will look uneven.
  • Not a load balancer. DNS picks an address once, and the user’s connection stays there. For fine-grained, instant balancing, use a real load balancer behind the DNS answer.
i
Best of both

A common design uses a global load balancer for fast, in-connection balancing and health handling, and uses DNS routing policies only for coarse, slower decisions such as sending a region’s users to the right regional front door.

IDNS Inside Your Cloud Network

How a virtual machine decides where to ask, and in which order it consults your rules.

Inside Google Cloud, your virtual machines live in a VPC network, which is your private virtual network. Each machine is automatically set up to send its DNS questions to a built-in resolver, reached through a special internal address called the metadata server. You do not install anything. This built-in resolver reads your private zones, forwarding rules, peering settings and policies, and decides how to answer.

Analogy

The built-in resolver is like a helpful office receptionist. Staff members ask the receptionist, who first looks at the company’s special instructions, then the internal staff list, then the other branches, and only at the end calls outside enquiries. Staff never need to know how the receptionist finds each answer.

The order of resolution

The resolver follows a sensible order. The exact details may change, so read the current documentation, but the general idea is shown below.

flowchart TD
  VM["VM asks the metadata server resolver"] --> RP{"Matching response policy rule?"}
  RP -- "Yes" --> RPA["Return the override answer"]
  RP -- "No" --> ZN{"Matching private, forwarding or peering zone?"}
  ZN -- "Private zone" --> PZ["Answer from the private zone"]
  ZN -- "Forwarding zone" --> FZ["Forward to the listed name servers"]
  ZN -- "Peering zone" --> PE["Ask the peer network's DNS view"]
  ZN -- "None" --> INT{"Is it a Compute Engine internal name?"}
  INT -- "Yes" --> IN["Answer with the internal DNS"]
  INT -- "No" --> PUB["Resolve on the public internet"]
    
Figure 5: The general order in which a VM’s DNS questions are answered.

The pieces in the order

1

Response policies

Special rules that override answers for specific names. They are checked first, so you can block a bad domain or redirect a name for the whole network without editing zones.

2

Private, forwarding and peering zones

If the asked name falls under one of these zones, the most specific match wins. A zone for a subdomain beats a zone for its parent domain.

3

Compute Engine internal DNS

Google gives every virtual machine an internal name automatically, so machines can find each other without any setup of your own.

4

Public resolution

If nothing above matches, the resolver looks the name up on the public internet like any other resolver.

DNS policies

A DNS policy is a set of network-wide settings that changes how the resolver behaves. There are several kinds, and each is attached to chosen networks.

Inbound

Inbound forwarding policy

Creates entry-point addresses inside your VPC so that machines in your office or data centre can send DNS questions into Google Cloud and resolve your private zones.

Outbound

Alternative name servers

Tells the network to send all its questions to name servers you choose, such as your own, instead of the built-in resolver. This replaces the default order, so use it with care.

Logging

Query logging

Records the questions made by machines in the network to Cloud Logging, so you can investigate problems and detect suspicious behaviour.

Override

Response policies

Sets rules that return chosen answers for chosen names, regardless of other zones.

Compute Engine internal DNS

Every virtual machine automatically gets an internal DNS name. These names work only inside your VPC and are convenient for quick, small setups. They come in a zonal form, which includes the machine’s zone and project, and optionally in a global form. They are not meant to replace carefully designed private zones. For a serious application, create your own private zone with stable, meaningful names such as the name of the database service, and point those names at addresses you control, so that replacing a machine does not break the clients.

i
Googleapis pattern

A popular use of private zones is to make machines that have no public internet access reach Google’s own APIs privately. You create a private zone for the Google API domain and point it to Google’s special private access addresses. Follow the current Google documentation for the exact names and addresses, because the details matter.

Cloud DNS for Kubernetes clusters

Google Kubernetes Engine clusters need their own DNS to let containers find each other by service name. Besides the classic in-cluster DNS software, Cloud DNS can provide this function as a managed service, either for one cluster or shared across a VPC. This can reduce the amount of DNS software your cluster must run and scale, and it makes cluster names resolvable from outside the cluster when you choose the wider scope. Check the current documentation to choose between the options.

JHybrid DNS: Connecting Cloud and On-Premises

Many companies live in two worlds at once. DNS is the glue that lets both worlds find each other.

Most large organisations still have servers in their own offices or data centres, called on premises, and they also run workloads in Google Cloud. A payroll application in the cloud may need to call a database in the office, and an office tool may need to reach a cloud service. Both sides must be able to resolve the other’s private names. This arrangement is called hybrid DNS.

Analogy

Imagine two companies sharing a building through a connecting corridor. Each has its own staff directory. For people to call each other, the reception on each side must know “for names on that side, ask their reception”. Hybrid DNS sets up exactly that agreement between the two receptions.

flowchart LR
  subgraph ONP["On-Premises Network"]
    OD["On-premises DNS servers"]
    OH["Office server: db.corp.example"]
  end
  subgraph GC["Google Cloud VPC"]
    VMX["VM asks for db.corp.example"]
    FZN["Forwarding zone for corp.example"]
    IEP["Inbound forwarding entry point"]
    PZN["Private zone for cloud.example"]
  end
  VMX --> FZN
  FZN -->|"Over VPN or Interconnect"| OD
  OD --> OH
  OD -->|"Asks for names under cloud.example"| IEP
  IEP --> PZN
    
Figure 6: Both directions of hybrid DNS, using a forwarding zone out and an inbound entry point in.

The two directions

Cloud to office

Outbound: forwarding zones

You create a forwarding zone for the office domain and list the office DNS servers. When a cloud machine asks for an office name, the resolver forwards the question there.

Office to cloud

Inbound: forwarding policy

You enable an inbound policy to get entry-point addresses in your VPC. You then configure the office DNS servers to forward cloud names to those addresses.

What you need before it works

1

A private network link

You need a secure connection between the office and Google Cloud, such as a VPN or a dedicated Interconnect. DNS questions travel over this link.

2

Correct routes

Both sides must know how to reach the other’s DNS servers, so check routing in both directions, including the return path.

3

Firewall permissions

Firewalls in the office and in the cloud must allow DNS traffic on the usual DNS ports, from the source ranges that Google documents for forwarding.

4

Clear domain ownership

Decide which side is authoritative for which names, so the same name is never defined in two conflicting places.

5

Test in both directions

Look up an office name from a cloud machine, and a cloud name from an office machine, before trusting the setup.

Sharing DNS across many projects: hub and spoke

Large companies have many projects and networks. Copying the same forwarding rules into every network is tedious and error-prone. A cleaner design is hub and spoke. One central network, the hub, owns the forwarding zones, the inbound policy and the shared private zones. Other networks, the spokes, use DNS peering to ask the hub for those names. Changes are then made in one place. Note that DNS peering is generally not transitive, which means a spoke can ask the hub, but cannot chain through the hub to reach another peer, so plan the shape of your design with that rule in mind.

!
Loop danger

If the cloud forwards a domain to the office and the office forwards the same domain back to the cloud, questions can bounce forever, and both sides become slow. Draw the flow on paper for each domain, and make sure every name has exactly one place where it is finally answered.

KManaging Records Safely

A tiny typo in a DNS record can take a whole company offline. Safe habits matter more here than almost anywhere else.

DNS has a fierce character: a single wrong character in an address or a deleted record can make a website, an app and an email service vanish at the same time, and the damage spreads as caches refresh. Because the effects are broad and the cache delays make recovery slow, a careful change process is a core skill.

Analogy

Editing DNS is like changing the road signs for a whole city overnight. A wrong sign sends thousands of cars the wrong way before anyone notices, and fixing the sign does not immediately fix the cars already on the road.

Changes are transactions

Cloud DNS applies edits as a single group, often called a change or a transaction. You can add and remove several records together, and either all of them take effect or none do. This is very useful, for example when you swap an old address for a new one in one atomic step, so there is never a moment when the name has no record.

A safe change routine

1

Plan the change and the way back

Write down the exact records before and after, and how you will revert. Having the old values at hand is the best rollback plan.

2

Lower the TTL in advance

At least one old TTL period before the change, lower the TTL of the affected records. Then caches will expire quickly when you switch.

3

Review the change

Have a second person check it. If your records live in code, review it as a code change before it is applied.

4

Apply and test directly

Query the Cloud DNS name servers directly to confirm the new answer, before and after caches matter. Then test from several outside resolvers.

5

Watch, then raise the TTL

Watch errors and traffic. Once the new setup is proven, raise the TTL again to reduce query load.

6

Keep the old target alive

Leave the old servers running until the longest old TTL has passed, because some users still reach them.

Infrastructure as code

Treating DNS as code is one of the best habits a team can adopt. Tools such as Terraform describe zones and records in text files kept in version control. Every change is reviewed, recorded and repeatable. If someone deletes a record by accident, the file shows what should exist, and the tool can restore it. Code also makes it easy to build the same setup in test and production, and to rebuild an entire zone after a disaster.

Import and export

Cloud DNS can import records from a standard zone file format and export them again. This is helpful when moving from another provider, taking a backup of your records or comparing environments. Keep a recent export of important zones stored safely outside the zone itself, so that even a deleted zone can be rebuilt quickly.

Naming and housekeeping

Names

Consistent naming

Use clear patterns for names, such as service, environment and region, so everyone can tell what a record is for.

Labels

Labels and descriptions

Add owner and purpose to zones, so stray zones are never a mystery months later.

Clean

Remove dead records

Delete records that point to retired servers. Dangling records are a security risk, as the security chapter explains.

Review

Regular audits

Once a quarter, list every zone and record set and confirm that each still has an owner and a purpose.

!
Deleting a zone

Deleting a public zone removes its records, and the world’s resolvers will soon see failures. Restrict who may delete zones, require review, and keep an export ready. Never delete a zone just to recreate it, because the new zone gets different name servers and the registrar settings would then be wrong.

LDNSSEC: Signing Your Answers

Plain DNS answers can be forged. DNSSEC adds a digital signature so that forgeries can be detected.

The original DNS was built on trust. A resolver accepted an answer if it looked right. Attackers learned to forge answers, a trick sometimes called cache poisoning, and send users to fake websites. DNSSEC, short for DNS Security Extensions, adds digital signatures to DNS data. A digital signature is a mathematical proof that the data came from the zone owner and was not altered on the way.

Analogy

Plain DNS is like a letter with no seal: anyone could have written it. DNSSEC is a letter with a wax seal pressed by the official signet ring. The receiver cannot see the ring itself, but can check that the seal matches the known pattern, and a forged letter will fail the check.

How the chain of trust works

1

Cloud DNS signs your zone

Once you turn DNSSEC on for a public zone, Cloud DNS creates keys and signs every record set. It also manages key rotation for you.

2

You publish a fingerprint at the registrar

You give the registrar a small record called a DS record, which holds a fingerprint of your zone’s main key. The parent zone then publishes it.

3

Resolvers verify upwards

A validating resolver checks the signatures on your answers, then checks your key against the fingerprint in the parent, and continues up to the root, which everyone trusts.

4

Forged answers are rejected

If a signature does not match, the resolver refuses the answer and returns an error instead of sending the user to a fake site.

The risk: a broken chain looks like an outage

DNSSEC protects users, but it also adds a way for you to cause a sudden outage. If the fingerprint at the registrar does not match the keys in Cloud DNS, validating resolvers will reject all your answers and your domain will appear to be down for many users, while non-validating resolvers still work and make the problem confusing to diagnose. Mismatches happen when keys are changed without updating the registrar, when a zone is moved to another provider with DNSSEC still enabled at the registrar, or when DNSSEC is turned off in the zone while the fingerprint is still published.

!
Order matters

When you disable DNSSEC, remove the DS record at the registrar first, wait for old caches to expire, and only then turn off signing in Cloud DNS. When you move a signed zone to another provider, plan the key hand-over carefully. Follow the current official steps for each case.

Should you enable it?

Reasons to enable

  • Protects users from forged answers and cache poisoning.
  • Often expected by security standards and large customers.
  • Cloud DNS manages keys and rotation for you.
  • Supports stronger overall trust in your domain.

Things to handle with care

  • A DS mismatch can cause an outage for validating resolvers.
  • Your registrar and top-level domain must support it.
  • Moves and key changes need an exact procedure.
  • Responses become larger, which can affect some networks.

DNSSEC does not encrypt your queries and does not hide what names people look up. It only proves that answers are genuine. Think of it as an integrity feature, not a privacy feature.

MSecurity and Access Control

Google secures the servers. You decide who may change your names and how you guard against name hijacking.

Cloud security follows a shared responsibility model. Google protects the DNS servers, the network and the service itself. You are responsible for who can edit your zones, how you protect your registrar account, and what names and data you publish. DNS is a favourite target because control of a name means control of where users, and often their email, are sent.

Analogy

A bank guards its vault, but an account holder who gives a stranger the password to the online account loses money anyway. Cloud DNS guards the machinery, and you guard the keys to your names.

Identity and Access Management

Identity and Access Management, called IAM, decides which people and programs may do what. A role is a bundle of permissions. Cloud DNS offers roles such as an administrator who can manage zones and records, a reader who can only view them, and a peer role used for DNS peering. Follow the principle of least privilege: give each person only the role they need, at the narrowest level possible, such as one project or one zone. Developers might be allowed to edit records for a test zone, while only a few trusted engineers can change the production zone.

Threats to watch for

Takeover

Dangling records

A name that still points to a deleted cloud service or storage bucket can be claimed by an attacker, who then serves content under your name. Remove records when you retire the target.

Hijack

Registrar compromise

If an attacker controls your registrar account, they can point your domain at their own name servers. Use strong sign-in, two-step verification and registrar locks.

Forgery

Spoofed answers

Forged responses can mislead users. DNSSEC lets resolvers detect them for public zones.

Leak

Exposed internal names

Putting internal server names in a public zone tells attackers about your network. Keep internal names in private zones.

Abuse

Malicious domains

Machines may try to reach harmful sites. Response policies can block or redirect them for a whole network.

Tunnelling

Data hidden in DNS

Attackers can smuggle data out through strange-looking DNS questions. Query logs help you notice odd patterns.

Good security habits

  • Separate projects. Keep production zones in a tightly controlled project, separate from development.
  • Audit logs. Make sure administrative actions are recorded and retained, so you can answer who changed what and when.
  • CAA records. Publish records that list which certificate authorities may issue certificates for your domain.
  • Change review. Treat DNS changes like code changes, with a second pair of eyes for production.
  • Clean-up routine. Regularly remove records that point to retired services.
  • Registrar protection. Turn on registrar locks and use a shared mailbox with strong authentication for the account owner.
i
Email protection

Email-related TXT records for SPF, DKIM and DMARC help stop criminals from sending forged email under your domain. They are DNS settings, so they are part of your security work too.

NMonitoring, Logging and Metrics

DNS problems hide well, because everything above DNS blames DNS last. Good signals let you suspect it first.

Cloud DNS sends metrics, which are measured numbers over time, to Cloud Monitoring. It can also write logs to Cloud Logging, which are line-by-line records of events. Metrics show you how many questions arrive and how they are answered. Logs show the actual questions and who asked them. Audit logs record who changed what in your zones.

Analogy

Metrics are the visitor counter at a shop door, showing how many people came each hour. Logs are the guest book listing who came and what they asked for. Audit logs are the key register showing who opened the safe. You need all three to understand a bad day.

The signals worth watching

Volume
how many queries arrive
Response codes
answers, missing names and errors
Changes
who edited which records
Volume

Query count

Know your normal level. A sudden spike may mean an attack or a misbehaving application, and a sudden drop to near zero may mean broken delegation.

NXDOMAIN

Names that do not exist

A rising share of “no such name” answers suggests typos, retired records, or probing by attackers hunting for hidden names.

SERVFAIL

Server failure answers

These indicate trouble resolving, for example a forwarding target that is not responding, or a DNSSEC validation problem.

Audit

Change history

Every record change and zone change is logged with the identity of the person or program that made it.

Query logging

For networks inside Google Cloud, you can enable query logging through a DNS policy, so each question made by your machines is recorded. For public zones, logging options exist too, and you should check the current documentation for what is offered. Query logs are very useful for investigating incidents, for finding which application asks for a missing name, and for spotting machines that contact suspicious domains. They can also grow large, so set sensible retention and consider the cost.

Alerts that help

  • Query volume far above or below normal. Both directions deserve attention.
  • Rising error answers. A sharp increase in SERVFAIL is almost always worth a look.
  • Any change to production zones. A notification for each change gives the team visibility and a chance to catch surprises.
  • External checks. Use probes from outside your network that look up your important names and compare the answers with what you expect.
  • Domain expiry. Keep an alert for the registration expiry date of every domain. An expired domain is the most embarrassing outage of all.

Testing from the outside

Command-line tools such as dig and nslookup let you ask a DNS server a question and read the full answer, including the TTL. A powerful technique is to ask your Cloud DNS name servers directly, which shows what you have published, and then ask a public resolver, which shows what the world currently sees. If the two disagree, either caches have not expired yet, or delegation is wrong.

i
Dashboard idea

Build one dashboard with query volume, error answers by type, and recent zone changes on the same screen. During an incident, the dashboard shows at once whether the cause is a change, a spike or an error.

OReliability, Failure Scenarios and Troubleshooting

Cloud DNS itself is very reliable. Most DNS outages come from configuration, not from Google’s servers.

Google runs Cloud DNS across many locations with spare capacity and advertises a very strong availability promise. This means that if your domain is unreachable because of DNS, the cause is far more often a setting, a change or a dependency than a failure of the service. Learning the usual suspects will make you a fast troubleshooter.

SymptomCommon causeFirst thing to check
Name never resolves from the internetZone not delegated, or registrar points to the wrong name serversCompare the registrar’s NS list with the zone’s assigned name servers
Some users fail, others workDNSSEC fingerprint mismatch, or stale cachesTest with a validating and a non-validating resolver
Everything fails at a certain dateDomain registration expiredCheck the registrar and renew at once
New record not visible yetCached “no such name” answer or old TTLAsk the Cloud DNS name server directly, then wait out the cache
Cloud machine cannot resolve an office nameForwarding zone, VPN route or firewall issueTest reachability of the office DNS server from the VPC
Office cannot resolve a cloud nameInbound policy missing or office server not forwardingCheck the entry-point addresses and the office forwarder
Internal name returns a public addressPrivate zone not attached to the networkCheck which networks the private zone is visible to
Name works publicly but not inside the VPCPrivate zone hides the public recordAdd the missing record to the private zone
Analogy

Troubleshooting DNS is like tracing a missing parcel. You check each hand-off in order: the sender’s label, the sorting office, the local depot, the final delivery. The fault is almost never in the postal system’s trucks, and almost always in one wrong label.

A reliable troubleshooting path

1

Ask the authoritative server directly

Query one of the Cloud DNS name servers for your zone. This shows exactly what you published, free from caches.

2

Check delegation

Confirm the registrar’s name servers match the zone’s name servers, with no old provider left behind.

3

Ask public resolvers

Try several well-known resolvers, and compare the answer and its remaining TTL. Different answers point to caching or policy differences.

4

Test DNSSEC

If only some users fail, check whether signatures validate, and whether the registrar fingerprint matches the zone’s current key.

5

Look inside the VPC

For private names, test from a machine in the network. Check zone visibility, policies and which resolver the machine actually uses.

6

Read the logs

Check audit logs for recent changes and query logs for the questions that failed.

Planning for the bad day

DNS is a dependency of everything, so protect it well. Keep zones in code, so they can be rebuilt. Keep exports as backups. Keep the registrar account safe, with more than one trusted administrator. Choose TTLs that allow you to recover in a reasonable time. For critical systems, consider using more than one DNS provider for a zone, a design called multi-provider DNS, which protects against a failure of any single provider, though it needs careful synchronisation of records and cannot use features unique to one provider.

!
Do not forget the registrar

Your zone can be flawless, and your domain can still vanish if registration lapses or the registrar account is compromised. Treat the registrar with the same seriousness as the DNS zone itself, with renewal alerts, strong authentication and documented ownership.

PPerformance, Caching and TTL Tuning

DNS is already fast. Your choices decide how often a user waits for a lookup at all.

Cloud DNS answers quickly because of anycast and because each location holds the full zone data. From your side, the practical performance work is about how many lookups each page needs, and how long answers may be cached. Every unnecessary lookup adds a small delay, and because lookups happen at the start of every connection, small delays add up.

Analogy

Imagine a delivery driver who must look up each customer’s address in a directory before every trip. The fastest directory in the world still costs a few seconds each time. Reducing the number of lookups, by remembering addresses for a sensible time, saves far more than speeding up the directory.

Choosing TTLs

Kind of recordSuggested style of TTLReason
Stable names that rarely changeLong, such as an hour or moreFewer queries, faster lookups, less cost
Names under active change or migrationShort, such as a minute or a fewQuick rollbacks and quick switches
Failover and weighted recordsShort, often thirty to a few hundred secondsSteering decisions must spread quickly
Mail and verification recordsMedium to longThey rarely change and benefit from caching
NS and DS recordsLong, following parent zone practiceStability of the delegation chain matters most

There is no single perfect TTL. A good approach is to set a reasonable default, lower it before planned changes, and raise it afterwards. Remember that a very short TTL on a busy name multiplies query volume and your bill, while a very long TTL turns a small mistake into a long outage.

Ways to cut lookups

Chains

Avoid long CNAME chains

Each alias adds another lookup. Point names directly to addresses where you can.

Domains

Limit the number of domains per page

A web page that loads assets from many different names needs a lookup for each one.

Reuse

Reuse connections

Applications that keep connections open avoid repeating lookups for each request.

Client

Respect TTLs in applications

Some programs cache a lookup forever. Others look up on every call. Use sensible caching so changes are noticed without flooding resolvers.

Application caching pitfalls

Not every program obeys TTLs. Some programming runtimes cache an address for the life of the process, so after a DNS change the program keeps talking to the old server until it is restarted. When you plan a migration, include the clients in your checklist. Find out how long each important client keeps lookups, and restart or reconfigure the long-lived ones when you cut over.

i
Load test your forwarding

If many machines in the cloud forward questions to a small office DNS server, that office server may become the bottleneck. Check its capacity and its rate limits, and use caching on the cloud side to reduce the load.

QCost and Billing

DNS is one of the cheapest parts of a cloud bill, but a few habits can still make it surprising.

Cloud DNS billing has a small number of parts. Prices change and vary, so always check the official pricing page. The description below explains how the bill is built, without quoting numbers.

Zones

Managed zones

A small charge per zone for each month it exists, whether public or private. Many forgotten zones add up.

Queries

Query volume

A charge per million queries answered, often with lower rates as volume rises. Short TTLs and heavy traffic raise this part.

Logs

Logging storage

Query logging writes to Cloud Logging, which has its own ingestion and storage charges.

Domains

Registration separately

The domain registration fee belongs to your registrar or Cloud Domains, not to Cloud DNS.

Analogy

It is like a phone directory service that charges a small yearly fee for each list you keep, plus a tiny fee for each call it answers. A single list is almost free, but a company with hundreds of forgotten lists and millions of calls will notice the sum.

What drives the bill up

  • Very short TTLs on busy names. They multiply queries, because caches expire constantly.
  • Query floods and random-name attacks. Attackers can send huge numbers of lookups for made-up names. Cloud DNS absorbs them, but you may still be billed for the volume, so watch for unusual spikes.
  • Chatty applications. A program that looks up the same name for every request, with no caching, creates needless load.
  • Forgotten zones. Test and old project zones continue to cost money each month.
  • Verbose query logging. Logging every question for a busy network produces large volumes of data.

How to keep it under control

1

List all zones monthly

Confirm every zone has an owner and a purpose, and delete the ones that do not.

2

Review TTLs

Look for stable names with unnecessarily short TTLs and raise them.

3

Watch query volume

Set an alert for unusual jumps, which catches both attacks and application bugs early.

4

Log with purpose

Turn on query logging where you need it, set short retention, and filter where you can.

5

Set a budget alert

A simple alert at a percentage of the expected monthly spend avoids unpleasant surprises.

i
Keep perspective

For most organisations, DNS is a very small part of the cloud bill. Do not sacrifice safety, such as using painfully long TTLs, just to save a few pennies. The cost of an outage dwarfs the cost of a query.

RAdvantages, Disadvantages and Trade-offs

An honest look at what you gain and what you give up.

Advantages

  • Fully managed, with no DNS servers to run or patch.
  • Global anycast serving with strong availability goals.
  • Public, private, forwarding and peering zones in one product.
  • Integrates with VPC networks, GKE and load balancers.
  • Managed DNSSEC with automatic key handling.
  • Routing policies for weighted, geographic and failover answers.
  • Atomic changes, audit logs and infrastructure-as-code support.
  • Low cost for most workloads.

Disadvantages

  • Not a registrar, so registration is handled separately.
  • Authoritative only, with no general-purpose recursive service for the public.
  • Some advanced features of full DNS software are missing.
  • Changes can be slowed by caches outside your control.
  • Routing policies depend on resolver behaviour and are approximate.
  • Hybrid setups need careful network and firewall work.
  • Tied to Google Cloud tooling, though zone files can be exported.

The big trade-offs in plain words

Simplicity against flexibility. Cloud DNS handles the common cases with very little effort. If you need very special behaviour, such as custom response logic written in code, a self-run DNS server may suit better, but then you own its uptime and security.

Speed of change against safety of caches. Short TTLs let you change quickly and recover quickly, but they cost more and create more load. Long TTLs are cheap and quick for users but make mistakes linger. You choose a balance for each name.

One provider against many. A single managed provider is simple to run. Using two providers protects against the loss of one but adds synchronisation work and limits you to features that both support.

Analogy

Choosing managed DNS is like using a professional postal service rather than running your own couriers. You give up some custom control, but you gain reliability, reach and peace of mind, and you spend your time on your real business instead of on delivery vans.

DNS is invisible when it works and unforgettable when it fails, so spend a little care early and save a lot of trouble later.

SCloud DNS vs Other Naming Options

Several products and approaches deal with names. Knowing the neighbours avoids confusion.

Authoritative

Cloud DNS

Hosts your zones, public and private, serves answers, and links cloud and office networks.

Registrar

Cloud Domains

Registers and renews domain names. It works with Cloud DNS but is a separate product.

Internal

Compute Engine internal DNS

Gives each virtual machine an automatic internal name. Convenient, but not a designed naming system.

Discovery

Service Directory

A registry where services register themselves, with lookups by name through its own interfaces or through DNS.

Traffic

Cloud Load Balancing

Spreads actual connections across servers. It uses an address that DNS points to, so the two work together.

Self-run

Your own DNS servers

Software such as BIND or CoreDNS that you run on machines. Maximum control, maximum responsibility.

Comparing the main options

TopicCloud DNSSelf-run DNS serversInternal DNS only
Who runs the serversGoogleYouGoogle, automatically
Public internet answersYes, with anycastYes, if you build and secure itNo
Private names inside a VPCYes, private zonesPossible, with extra setupBasic machine names only
Hybrid with office networksForwarding and inbound policiesFull flexibility, manual workNot designed for it
Advanced custom featuresLimited to supported featuresUnlimitedNone
Operational effortLowHighVery low
Best forMost cloud and hybrid workloadsUnusual requirements and special softwareSmall tests and quick experiments

A common beginner confusion is to expect Cloud DNS to register domains or to load balance traffic. It does neither. The healthy picture is: a registrar owns the name, Cloud DNS answers questions about it, and a load balancer or server receives the traffic that the answer points to. A second confusion is to treat automatic internal names as a naming strategy. They work well for quick connections between a few machines, but real applications deserve deliberate private zones with stable names.

Analogy

The registrar is the land registry that records who owns a plot. Cloud DNS is the signboard and directory that tells visitors which gate to use. The load balancer is the gatekeeper who sends each visitor to a free room. Each has a different job, and they cooperate.

i
Using several together

A typical production setup uses all of them: a registrar for the name, Cloud DNS for public and private zones, a load balancer for traffic and health, and Service Directory for internal discovery where it helps.

TDesign Patterns That Fit Cloud DNS

A pattern is a proven recipe for a common problem. These seven work especially well.

1

Split-horizon naming

Use one domain with a public zone for outsiders and a private zone for internal machines, so the same names work everywhere with different answers where needed.

2

Hub-and-spoke DNS

Keep forwarding rules, inbound policies and shared private zones in one hub network, and let spokes use peering. Changes happen in one place.

3

Subdomain delegation per team

Delegate each team’s subdomain to its own zone, with its own permissions. A mistake by one team cannot damage another team’s names.

4

Low-TTL cutover

Lower the TTL in advance, switch to the new target, watch, and raise the TTL again. This gives quick, safe migrations and rollbacks.

5

Weighted canary rollout

Send a small share of lookups to the new version of a service. Increase the weight as confidence grows, and drop it to zero if trouble appears.

6

DNS as code

Describe zones and records in version-controlled files, review every change, and apply it with automation, so history and rebuilds are easy.

7

Policy-based blocking

Use response policies to block known harmful domains for the whole network, with logging to see who tried to reach them.

Analogy

Hub-and-spoke DNS is like a head office switchboard that holds the company’s master directory. Branch offices simply ask the head office. When a department moves, only the head office directory needs updating, and every branch gets the new answer at once.

Stable names in front of changing things

One of the most valuable habits is to give every important service a stable, meaningful name, and never let clients depend on raw addresses. When a database moves or a server is replaced, only the record changes, and no client needs editing. This idea, called indirection, turns a risky change across many applications into a simple change in one place. It is the quiet reason why well-run systems can move quickly without breaking things.

Blue-green with DNS

In a blue-green release, two identical environments exist: the live one and the new one. DNS lets you move users from blue to green by changing a record, or gradually by weight. If green misbehaves, you move back. Because caches cause delays, pair this pattern with short TTLs, and keep the blue environment running until the old TTL has fully expired.

UAnti-patterns to Avoid

An anti-pattern is a habit that looks sensible at first and causes pain later.

AP-01 · HARD-CODED IP ADDRESSESAvoid
What it looks like

Applications and scripts contain raw server addresses instead of names.

Why it hurts

When the server moves or is replaced, every client must be found and edited, and some will be forgotten and break.

Better approach

Use stable names for every service, and let DNS records absorb the changes.

AP-02 · DELETE AND RECREATE THE ZONEAvoid
What it looks like

To fix a mess, someone deletes a public zone and creates a new one with the same name.

Why it hurts

The new zone gets different name servers, so the registrar still points to the old ones. The domain goes dark until the delegation is repaired and caches expire.

Better approach

Edit records in place, with atomic changes. If a rebuild is essential, update the registrar before or together with the switch.

AP-03 · ENORMOUS TTLS BEFORE A MIGRATIONAvoid
What it looks like

A record with a TTL of a day or more is switched to a new server without any preparation.

Why it hurts

Users keep the old address for up to a day, and rollback is equally slow, so a mistake lingers.

Better approach

Lower the TTL well before the change, then raise it after success.

AP-04 · DANGLING RECORDSAvoid
What it looks like

A name still points to a cloud service, bucket or server that has been deleted.

Why it hurts

An attacker may claim the abandoned target and serve content under your trusted name, a risk known as subdomain takeover.

Better approach

Delete the record when you retire the target, and audit records regularly.

AP-05 · DNSSEC WITHOUT A PLANAvoid
What it looks like

DNSSEC is switched on, or a zone is moved, with no plan for the registrar’s fingerprint record.

Why it hurts

A mismatch makes validating resolvers reject every answer, and the domain appears to be down for many users.

Better approach

Follow the exact official procedure, update the registrar in the right order, and test with a validating resolver.

AP-06 · INTERNAL NAMES IN PUBLIC ZONESAvoid
What it looks like

Names for databases, admin tools and internal servers are published in a public zone.

Why it hurts

Anyone on the internet can list your internal names and addresses, which helps attackers map your network.

Better approach

Keep internal names in private zones, visible only to the networks that need them.

VBest Practices and Common Mistakes

A checklist to read before your first production launch.

Best practices

Code

Keep DNS in code

Define zones and records in version control, review changes and apply them through automation.

Separate

Separate production from the rest

Use different projects and tight permissions for production zones.

TTL

Plan TTLs deliberately

Long for stable names, short for names that move, and lowered ahead of any planned change.

Private

Use private zones for internal names

Keep internal names out of public view, with stable names for every service.

Hybrid

Design hybrid DNS on paper first

Decide which side owns which names and draw the question flow for every domain.

Backup

Keep exports of every zone

A recent export lets you rebuild a deleted or damaged zone in minutes.

Watch

Alert on volume, errors and changes

Watch for spikes, drops, server-failure answers and any change to production zones.

Registrar

Protect the registrar account

Use strong sign-in, locks, shared ownership and renewal alerts for every domain.

Common mistakes

Creating the zone but forgetting delegation

The zone is perfect, but the registrar still points elsewhere, so nobody asks Cloud DNS. Always compare the registrar’s name servers with the zone’s.

Letting a domain expire

A lapsed registration takes down every service on the domain, at once. Use auto-renewal and calendar alerts.

Placing a CNAME at the bare domain

It is not allowed because the apex must hold other records. Use address records for the apex.

Forgetting that private zones hide public records

Inside a network that sees a private zone, missing records are not filled in from the public zone. Keep both in sync for shared names.

Testing only through caches

Looking up a name through your own resolver may show an old answer. Test against the authoritative servers too.

Forgetting long-lived clients

Some programs hold on to an old address until restarted. Include them in migration checklists.

Skipping the second pair of eyes

A single mistyped character can take down a business. Review production changes.

i
Habit

Write a short DNS checklist covering delegation, TTLs, rollback values, monitoring, registrar protection and exports. Review it before every major change, like a pilot checking the list before every flight.

WReal-World and Industry Examples

How organisations typically use Cloud DNS in production.

The architectures of particular companies change often and are seldom published in detail, so the examples below describe common industry patterns, not claims about any one named customer. Where a pattern is tied to something Google has said publicly, that is noted.

Google’s own global scale

Google has stated that Cloud DNS is served from the same global infrastructure that handles DNS for Google’s own services. This matters because it shows the kind of load the system was built for: huge numbers of questions, spread across the world, with very little tolerance for downtime. Customers benefit from this engineering even when their own traffic is small.

Large enterprises with a hybrid network

A bank or manufacturer with office data centres and cloud projects typically builds a hub-and-spoke design. One central network owns the forwarding zones to office DNS servers and an inbound policy for office-to-cloud lookups, while dozens of project networks use peering. Application teams get stable private names for databases and services, and the central network team controls the rules in one place.

Software-as-a-service platforms

A company that gives every customer a name of their own, such as a customer’s brand under the platform’s domain, often uses wildcard records or automation to create customer names quickly. Automation through the programming interface adds or removes records as customers join or leave, and short audit trails show what changed for support teams.

Online retail during big sales

Retailers preparing for a festival or a holiday sale lower TTLs days ahead, add failover or weighted records for the sale site, and double-check delegation and registrar settings. Monitoring watches query volume and error answers closely during the event, and the team keeps exports and rollback records ready.

Gaming and media with worldwide audiences

Companies with players or viewers around the world use geolocation routing to send people to the nearest regional front door, with short TTLs and a load balancer behind each region. The DNS decision is coarse, and the load balancer handles the fine detail of spreading connections.

Regulated and security-minded organisations

Teams that must show control over their environment use DNSSEC, certificate authority authorisation records, response policies that block harmful domains, strict IAM roles for zones and detailed query logging. Audit logs for every change support compliance reviews.

?
The common thread

In each pattern, DNS is treated as shared critical infrastructure. It has owners, reviews, monitoring and backups, and it uses stable names so that the systems behind the names can change freely.

XMoving to Cloud DNS and Keeping Current

Moving a live domain’s DNS is one of the few jobs where caution is the whole skill.

Moving a zone from another provider to Cloud DNS can be done without any downtime, because DNS lets two sets of servers hold the same records at the same time. The secret is to prepare the new zone completely, verify it, and only then change the delegation, while keeping the old zone alive until old caches expire.

Analogy

It is like moving a shop to a new street. You stock the new shop fully, test the till, put a sign on the old shop saying where you have moved, and keep the old shop open for a few weeks for customers who did not read the sign.

A calm migration path

1

Inventory everything

List every record in the old zone, including the unusual ones such as mail, verification and service records. Missing a single mail record can lose email.

2

Lower the TTLs

At the old provider, lower TTLs on records likely to change, and plan to wait at least one old TTL period before the cutover.

3

Create and populate the new zone

Create the Cloud DNS zone and import the records from a zone file, or create them from code. Note the name servers that Google assigns.

4

Verify against the new name servers

Ask the new name servers directly for every important name, and compare the answers with the old ones, record by record.

5

Handle DNSSEC carefully

If the domain is signed, follow the official procedure for removing the old fingerprint or transferring signing, so validating resolvers never see a mismatch.

6

Change the name servers at the registrar

Replace the old name server list with the Cloud DNS list, during a quiet period, with the old zone still serving the same records.

7

Wait, watch and clean up

Wait for the old delegation TTL to pass, which can be a day or two. Watch query volume shift to Cloud DNS, and only then retire the old zone.

Migrating private names into Google Cloud

If your internal names currently live on office DNS servers, you do not have to move them all at once. Start by creating forwarding zones so cloud machines can use the existing names. Then, as services move to the cloud, create private zones for the new names, and gradually reduce what the office servers hold. Keep a clear record of which side owns each name at each stage.

Keeping current

Cloud DNS gains features and changes details over time, such as new routing policy options, logging features, zone types and limits. Make it a habit to read the release notes a few times a year, and to review the current documentation before large projects. Check the quotas for the number of zones and records, since very large setups can approach them.

i
Start with a low-risk domain

If you have many domains, move a small, low-risk one first. You will learn the registrar’s process and Cloud DNS’s behaviour on a domain where a mistake costs little.

YFrequently Asked Questions

Quick answers to the questions beginners ask most often.

Q1Does Cloud DNS register domain names?
No. A registrar registers domains. Google’s separate Cloud Domains product, and many other companies, do that. Cloud DNS hosts the zone and answers questions about the names.
Q2I created a public zone, so why does my domain not work?
Most likely the registrar’s name servers still point elsewhere. Delegate to the name servers that Cloud DNS assigned to your zone, then test again after caches expire.
Q3How long do DNS changes take?
Cloud DNS publishes changes quickly. The world sees them as old cached answers expire, which depends on the TTL that the old answer carried. Lowering TTLs ahead of a change speeds this up.
Q4What is the difference between a public and a private zone?
A public zone answers anyone on the internet. A private zone answers only the networks you attach it to, and is used for internal names.
Q5Can I use the same domain publicly and privately?
Yes, using split-horizon DNS with a public zone and a private zone for the same domain. Keep shared names consistent in both.
Q6Why can I not use a CNAME for my root domain?
The root of a zone must hold other required records, and a name with a CNAME cannot hold anything else. Use address records at the root.
Q7How do office machines resolve my cloud private names?
Use an inbound forwarding policy to get entry-point addresses inside your VPC, and configure the office DNS servers to forward cloud names to them, over a VPN or Interconnect.
Q8How do cloud machines resolve office names?
Create a forwarding zone for the office domain that lists the office DNS servers, and make sure the network link and firewalls allow DNS traffic.
Q9Is DNSSEC required?
It is optional, but it protects users from forged answers and is often expected by security standards. Enable it with care, and follow the exact steps for the registrar fingerprint.
Q10Can DNS do load balancing?
Only roughly. Routing policies can spread or steer lookups, but caches and resolvers make it approximate. Use a load balancer for real, instant balancing.
Q11What TTL should I use?
Long for stable names, short for names that change often or use steering, and lowered before any planned change. A common starting point is a few minutes to an hour, adjusted to need.
Q12How do I protect against subdomain takeover?
Delete records when you retire the service they point to, audit records regularly, and keep ownership of every cloud resource that a name points to.
Q13Why do some users fail while others succeed?
Typical causes are cache differences, a DNSSEC mismatch that only validating resolvers notice, or routing policy differences by location. Test with several resolvers.
Q14Can I back up my zones?
Yes. Export records in a standard format and keep copies, and store your zones as code so you can rebuild them quickly.
Q15How do I avoid a surprise bill?
Delete unused zones, avoid needlessly short TTLs, watch for query spikes, log with purpose and set a budget alert.

ZSummary and Key Takeaways

If you remember only one page of this guide, make it this one.

Cloud DNS is Google Cloud’s managed, authoritative DNS service. It hosts public zones for the internet, private zones for your networks, and forwarding and peering features that connect cloud and office networks. It answers from many locations at once, so lookups are quick and the service stays available. Your own work lies in careful delegation, sensible TTLs, safe change habits, strict access control, protected registrar accounts and good monitoring, because most DNS outages come from configuration and not from the servers.

Key Takeaways

  • Cloud DNS answers questions, nothing more: it is authoritative DNS, while a registrar owns the name and a load balancer receives the traffic.
  • Delegation makes a zone real: a public zone works only after the registrar’s name servers point to the ones Cloud DNS assigned.
  • Choose the right zone type: public for the internet, private for internal names, forwarding for office DNS, peering to share names across networks, and split-horizon when both views are needed.
  • TTLs control speed of change: lower them before a planned change, keep the old target alive until caches expire, and raise them again afterwards.
  • Treat DNS as code and protect it: review changes, keep exports, use least-privilege roles, remove dangling records and guard the registrar account.
  • Handle DNSSEC with a plan: it blocks forged answers, but a mismatched fingerprint at the registrar can make a domain look down.
  • Watch and test properly: track query volume, error answers and changes, test against the authoritative servers, and check the current documentation before major projects.