Automatically Update A Record with Current IP

I've gotten tired of dealing the monthly renewal of my dynamic dns name. So I decided to write something to update my own DNS. Below is a script to update Gandi's DNS with your current external IP.

0 * * * * /home/pi/update-dns.sh
#!/usr/bin/env bash

DOMAIN="ryanhirsch.com"
A_RECORD="subdomain"
API_KEY="my-api-key-here"
EXTERNAL_IP=$(curl https://ifconfig.co)

curl -D- -X POST -H "Content-Type: application/json" \
  -H "X-Api-Key: $API_KEY" \
  -d '{"rrset_name": "'$A_RECORD'",
       "rrset_type": "A",
       "rrset_ttl": 3600,
       "rrset_values": ["'$EXTERNAL_IP'"]}' \
  https://dns.api.gandi.net/api/v5/domains/$DOMAIN/records