Created
July 12, 2017 11:11
-
-
Save jgamblin/fa60e453a6666fd4fc71632400ab9a82 to your computer and use it in GitHub Desktop.
Shell Script To Automatically Create A DNS A Record in Godaddy.
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
#!/bin/bash | |
DOMAIN=jgamblin.com | |
RECORD_NAME=newproject | |
GODADDY_API_KEY=(Get from devloper.godaddy.com) | |
GODADDY_API_SECRET=(Get from devloper.godaddy.com) | |
# Get IP Address | |
IP=`dig +short myip.opendns.com @resolver1.opendns.com` | |
# Create DNS A Record | |
curl -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H "Authorization: sso-key $GODADDY_API_KEY:$GODADDY_API_SECRET" "https://api.godaddy.com/v1/domains/$DOMAIN/records/A/$RECORD_NAME" -d "[{\"data\": \"$IP\"}]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment