Monitoring changes

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 record-sets changes --zone="myzonename" list

Python

def list_changes(project_id, zone_name):
    client = dns.Client(project=project_id)
    zone = client.zone(zone_name)

    changes = zone.list_changes()

    return [(change.started, change.status) for change in changes]

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-zones describe <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.

See also

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud DNS Documentation