Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



Managed Zones

A managed zone is the container for all of your DNS records that share the same DNS name prefix, for example, example.com . Managed zones are automatically assigned a set of name servers when they are created to handle responding to DNS queries for that zone. A managed zone has quotas for the number of resource records that it can include.

Before you begin

The Google Cloud DNS API requires that you create an Google Developers Console project and enable the Cloud DNS API.

If you are creating an application that will use the REST API, you will also need to create an OAuth 2.0 client ID.

  1. If you don't already have one, sign up for a Google account .
  2. Enable the Google Cloud DNS API in the Developers Console . You can choose an existing Compute Engine or App Engine project, or you can create a new project.
  3. If you need to make requests to the REST API, you will need to create an OAuth 2.0 ID:
    1. On the Credentials page in the APIs & Auth section, click Create new client ID .
    2. Choose Web application .
    3. In the Authorized JavaScript origins enter the host where you will serve this example, for example, http://localhost:8080 .
    4. Click Create Client ID .
  4. Note the following information in the project that you will need to input in later steps:
    • The client ID ( xxxxxx.apps.googleusercontent.com ).
    • The project ID that you wish to use. You can find the ID at the top of the Overview page in the Developers Console. You could also ask your user to provide the project name that they want to use in your app.

If you have not run the gcloud tool previously, you will need to run the following command to authenticate and specify the project name from the Developers Console:

gcloud auth login

You can also specify the --project parameter for a command to operate against a different project for that invocation.

Creating managed zones

When you get started with Cloud DNS API, you will need to create a managed zone to contain your DNS records. The managed zone is connected to your Google Developers Console project.

To create a zone, you must provide the DNS zone name, a description, and a name to identify the zone:

Command line

gcloud dns managed-zone create --dns_name="example.com." --description="A zone" "myzonename"

Python

BODY = {
  'name' : 'yourzonename',
  'dnsName' : 'example.com.',
  'description' : 'Example zone'
}
service = build('dns', 'v1beta1')
response = service.managedzones().create(project=PROJECT_NAME,
                                         body=BODY
                                         ).execute()

If you receive an accessNotConfigured error, you must enable the Cloud DNS API .

Listing managed zones

To list all of your zones within a project:

Command line

gcloud dns managed-zone list

Python

service = build('dns', 'v1beta1')
response = service.managedzones().list(project=PROJECT_NAME).execute()

Getting managed zone details

To get details about your managed zone, such as if you need to look up the associated name servers:

Command line

gcloud dns managed-zone get "myzonename"

Python

service = build('dns', 'v1beta1')
response = service.managedzones().get(project='project_name',
                                      managedZone='zone_name').execute()

Deleting managed zones

To delete a zone, provide the zone name to the delete command:

Command line

gcloud dns managed-zone delete "myzonename"

Python

service = build('dns', 'v1beta1')
response = service.managedzones().delete(project='project_name',
                                         managedZone='zone_name').execute()

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.