A simple bash script to update DNS records in Hetzner Cloud with your current public IP address. Ideal for dynamic DNS setups.
curl- Hetzner Cloud API token
Copy hetzner-cloud-ddns.conf.example to hetzner-cloud-ddns.conf and edit it:
HETZNER_API_TOKEN="your_api_token_here"
ZONE_NAME="example.com"
RECORD_NAME="home" # use "@" for apex
RECORD_TYPE="A" # A or AAAA
TTL="" # empty = zone defaultMake sure to protect the config file: chmod 600 hetzner-cloud-ddns.conf
# Run with default config (same directory as script)
./hetzner-cloud-ddns.sh
# Run with custom config path
./hetzner-cloud-ddns.sh /path/to/config.confUpdate every 5 minutes:
*/5 * * * * /path/to/hetzner-cloud-ddns.sh >> /path/to/hetzner-cloud-ddns.log 2>&1
- Fetches current public IP from multiple sources (failover)
- Compares with cached IP to avoid unnecessary API calls
- Updates the DNS record via Hetzner Cloud API if changed
MIT