Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trulow/a49e44cb7b2dbbfeb02c29e07d686811 to your computer and use it in GitHub Desktop.
Save trulow/a49e44cb7b2dbbfeb02c29e07d686811 to your computer and use it in GitHub Desktop.
Script to update a Google Domains DNS record
#!/bin/bash
### Google Domains provides an API to update a DNS "Syntheitc record". This script
### updates a record with the script-runner's public IP, as resolved using a DNS
### lookup.
###
### Google Dynamic DNS: https://support.google.com/domains/answer/6147083
### Synthetic Records: https://support.google.com/domains/answer/6069273
USERNAME=""
PASSWORD=""
HOSTNAME="yoursubdomain.yourdomain.here"
# Resolve current public IP
IP=$(curl -s "https://domains.google.com/checkip")
# Update Google DNS Record
URL="https://domains.google.com/nic/update?hostname=${HOSTNAME}&myip=${IP}"
curl --user ${USERNAME}:${PASSWORD} -s $URL
@NaRgetbackinyourcage
Copy link

does this work on windows?

@stevewasiura
Copy link

I converted this to vbscript for use on Microsoft Windows
https://gist.github.com/stevewasiura/21b35f4ed3bb32bdbf940d1bb807b8ae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment