When you make changes by using the command-line tool or REST API, they are initially marked as pending until the operation has completed. You can check on the status of changes or get a history of changes by using the command-line tool or REST API.
Listing changes for a managed zone
Command line
gcloud dns changes --zone="myzonename" list
Python
The following example demonstrates assembling a
changes.list
request by
using the
Python client library
. The sample
assumes your app has already acquired an access token to make API requests
on behalf of a user.
from apiclient import errors
from apiclient.discovery import build
PROJECT_NAME='<your-project-name>'
ZONE_NAME='<your-zone-name>'
try:
service = build('dns', 'v1beta1')
response = service.changes().list(project=PROJECT_NAME,
managedZone=ZONE_NAME,
).execute()
except errors.HttpError, error:
print 'An error occurred: %s' % error
Verifying DNS propagation
You can use the
watch
and
dig
commands to monitor and verify that your
changes have been picked up by the DNS name server. The following example
demonstrates looking up your name server and checking to see when a change to
an
MX
record is picked up by one of your managed zone's name servers.
Look up your zone's name servers:
gcloud dns managed-zone get <zone_name>
Check if the records are available yet on your authoritative name server.
Replace
<your_zone_nameserver>
with one of the name servers from the managed
zone:
watch dig example.com in MX @<your_zone's_nameserver>
The
watch
command will run the
dig
command every 2 seconds by default. You
can use this command determine when your authoritative name server picks up your
change, which should happen within 120 seconds. After your authoritative name
server has the change, DNS resolvers can start to pick up the new record.
Resolvers that already have the previous record cached will wait until the
previous TTL value for the record expires.
You can remove the
@<address>
from the dig command to run dig against your
system's name server or you can change the address to other name servers if you
would like to monitor propagation to other name servers.