Quickstart: Set up DNS records for a domain name with Cloud DNS

This page explains how to set up a Cloud DNS managed zone and a resource record for your domain name. It guides you through an example of creating a managed zone and then setting up Address (A) and Canonical Name (CNAME) records for the domain.


To follow step-by-step guidance for this task directly in the Google Cloud console, click Guide me:

Guide me


For more information, see the following resources:

  • For Cloud DNS concepts, see the Cloud DNS overview.
  • For terminology related to Cloud DNS, see Key terms.
  • For Virtual Private Cloud (VPC) network configuration information, see the VPC overview.
  • For configuration how-tos and API information, see What's next.

Requirements

This quickstart assumes that you have the following:

  • A domain name through a domain name registrar. You can register a domain name by using Cloud Domains or another domain registrar of your choice. Cloud Domains lets you manage domains by using the Cloud Domains API.
  • A Windows Server virtual machine (VM) instance or a Linux VM instance.
  • An IP address to point the A record of your zone to. A valid IP address can be a server that you already have running with an IP address that you can point to. For example, you can go through the Running a basic Apache Web server tutorial to start up a web server on a Compute Engine VM.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  5. Make sure that billing is enabled for your Google Cloud project.

  6. Enable the DNS API.

    Enable the API

Create a managed public zone in Cloud DNS

  1. In the Google Cloud console, go to the Create a DNS zone page.

    Go to Create a DNS zone

  2. To create a public DNS zone, click Create zone.

  3. For Zone type, choose Public.

  4. In the Zone name field, enter my-new-zone.

  5. In the DNS name field, enter the name of the domain that you purchased. Enter the domain name only. For example:

    example.com
    
  6. In the DNSSEC drop-down list, select Off.

  7. Click Create.

The Zone details page is displayed. Default NS and SOA records have been created for you.

To edit a record, on the Zone details page, at the end of the row for the record that you want to edit, click Edit.

Create a record to point the domain to an external IP address

If your IP address is in the format #.#.#.#, you have an IPv4 address and need to create an A record.

If your IP address is in the format #:#:#:#:#:#:#:#, you have an IPv6 address and need to create an AAAA record.

  1. In the Google Cloud console, go to the Cloud DNS page.

    Go to Cloud DNS

  2. Click the zone where you want to add a record set.

  3. Click Add standard.

  4. For Resource Record Type, to create an A record, select A. To create an AAAA record, select AAAA.

  5. For IPv4 Address or IPv6 Address, enter the IP address that you want to use with this domain.

  6. Click Create.

Create a CNAME record for the www subdomain

  1. In the Google Cloud console, go to the Cloud DNS page.

    Go to Cloud DNS

  2. Click the zone where you want to add a record set.

  3. Click Add standard.

  4. For DNS Name, enter www.

  5. For Resource Record Type, select CNAME.

  6. For Canonical name, enter the domain name, followed by a period (for example, example.com.).

  7. Click Create.

The record update takes some time to propagate depending on the time to live (TTL) values of the records. You can verify that the DNS records are working by visiting the domain name and confirming that the domain resolves to your IP address.

Update your domain name servers to publish your domain

Finally, you must update your domain's name servers to use Cloud DNS to publish your new records to the internet.

You have successfully used Cloud DNS to set up your DNS records.

Clean up

To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.

  1. In the Google Cloud console, go to the Cloud DNS zones page.

    Go to Cloud DNS zones

  2. Click the zone name (my-new-zone) to get to the Zone details page.

  3. Select the A and CNAME records that you created.

  4. Click Delete record sets.

  5. Go to the Cloud DNS zones page.

    Go to Cloud DNS zones

  6. To delete the zone, select the my-new-zone checkbox, and then at the end of the row, click Delete zone.

What's next