A cli for the DNSimple v2 API. This is not a complete API implementation. It should be great to use as a simple dynamic dns client.
There is no install, it's just bash
! Well, that's not true.
- curl
- jq
- dig
- Part of macOS
- On Linux it's usually the
dnsutils
package
- bash version >= 4
- If you're really stuck with bash v3.something, let me know and I'll take all the love and joy out of the script for you. ;)
- Login to DNSimple
- Go to your Account page (not your Settings)
- Go to Access Tokens
- Create an account access token.
- Add that to your
.bashrc
,.zshenv
, etc...export DNSIMPLE_ACCOUNT_TOKEN="The token from DNSimple"
- Reload your shell:
exec bash
,exec zsh
, etc...
$ ./dnsimple -h
Usage: dnsimple <command> [options] [command specific options]
OPTIONS:
-h, --help This.
--dat, Specify a \$DNSIMPLE_ACCOUNT_TOKEN, in lieu of or to
--account-token override the setting from your environment.
You can create 'User access token' on your dnsimple.com
User Settings page.
--api Override the default v2 API URL. The default is:
$_api
--compact Don't show the full json output.
COMMANDS:
whoami Prints info for your \$DNSIMPLE_ACCOUNT_TOKEN.
zones Prints available zones.
zone_info Prints info for a specific zone.
-z, --zone <zone name>
zone_records Prints records for a specific zone.
-z, --zone <zone name>
zone_record Prints info for a specific zone record.
-z, --zone <zone name>
-r, --record <record name>
zone_record_id Prints the id for a specific zone record.
-z, --zone <zone name>
-r, --record <record name>
update_a_record Creates/Updates the zone record with an IP address.
Specifying an IP address of "auto" will detect and use
the current public internet IP.
-z, --zone <zone name>
-r, --record <record name>
-i, --ip <IP or "auto">
$ ./dnsimple whoami
{
"data": {
"user": null,
"account": {
"id": ***Your Account ID***,
"email": "***Your Email Address***",
"created_at": "2010-11-16T14:19:28.219Z",
"updated_at": "2016-02-22T11:04:09.404Z"
}
}
}
$ ./dnsimple zones --account-id auto
# Pretty JSON of your available zones.
Read that as "update an A record" which is really my goal use case, as a dynamic DNS update client.
$ ./dnsimple update_a_record --zone chorn.net --record derp3 --ip auto
{
"data": {
"id": 5544144,
"zone_id": "chorn.net",
"parent_id": null,
"name": "derp3",
"content": "173.84.105.46",
"ttl": 3600,
"priority": null,
"type": "A",
"system_record": false,
"created_at": "2016-04-05T11:43:39.691Z",
"updated_at": "2016-04-12T10:50:59.576Z"
}
}
- Update other record types.