Skip to content

Instantly share code, notes, and snippets.

@rkorotaev
Created May 12, 2018 16:31
Show Gist options
  • Save rkorotaev/4590e6028992b2832fdde6f70e90eefb to your computer and use it in GitHub Desktop.
Save rkorotaev/4590e6028992b2832fdde6f70e90eefb to your computer and use it in GitHub Desktop.
Динамический DNS с помощью API Яндекс
#!/bin/sh
PDDTOKEN="123456789ABCDEFGHJKL00000000"
DOMAIN="example.net"
RECORD_ID="12345678"
SUBDOMAIN="aws"
# Получаем текущий IP-адрес ...
IP=$(curl -s http://ipv4.myexternalip.com/raw)
# ... назначаем его поддомену aws.example.net
curl -H "PddToken: $PDDTOKEN" \
-d "domain=$DOMAIN&record_id=$RECORD_ID&subdomain=$SUBDOMAIN&ttl=3600&content=$IP" \
https://pddimp.yandex.ru/api2/admin/dns/edit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment