Created
February 7, 2024 16:07
-
-
Save kusano/856ecdb80fc7873405396de7f0fa5e3b to your computer and use it in GitHub Desktop.
ddns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TOKEN='...' | |
ZONE_ID='...' | |
DNS_RECORD_ID='...' | |
DOMAIN='hoge.example.com' | |
IP=$(curl https://checkip.amazonaws.com/) | |
curl \ | |
--request PUT \ | |
--url "https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${DNS_RECORD_ID}" \ | |
--header 'Content-Type: application/json' \ | |
--header "Authorization: Bearer ${TOKEN}" \ | |
--data '{ | |
"content": "'${IP}'", | |
"name": "'${DOMAIN}'", | |
"proxied": false, | |
"type": "A", | |
"ttl": 3600 | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment