Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (17 sloc) 1.04 KB
# script: register new VM with TokenDNS
# author: Steffen <>
# notes: Use this script as your Startup script and configure "domain" and "apikey" as Metadata keys
# Call GCE Metadata Service
name=$(curl -s -H "Metadata-Flavor: Google")
apikey=$(curl -s -H "Metadata-Flavor: Google")
domain=$(curl -s -H "Metadata-Flavor: Google")
# Get IPv4 and IPv6 address
ipv4=$(curl -s -4
ipv6=$(curl -s -6
# Register A record
curl --get "" -d apikey=${apikey} -d name=${name} -d domain=${domain} -d type=A -d content=${ipv4}
# Register AAAA record (if IPv6 is available)
if [ -n "${ipv6}" ]; then
curl --get "" -d apikey=${apikey} -d name=${name} -d domain=${domain} -d type=AAAA -d content=${ipv6}
You can’t perform that action at this time.