There's nothing quite as convenient as not having to leave the warm ASCII glow of your Terminal window to make DNS changes. NS1's Command Line Interface (ns1cli) is a lightweight shell application that can be installed easily from the pip package manager, providing access to NS1's Data-Driven DNS platform at your fingertips.
From your command line, do a pip install for the ns1cli package:
$ pip install ns1cli
The requisite components will be loaded into your environment, and the utility will be ready to use.
Authentication + First Use
Using your NS1 API key, which is assigned within the NS1 portal, enter the following command to store your API key in the local configuration:
$ ns1 -k [YOUR NS1 API KEY]
The API key has now been stored in the local configuration as your default key, and will remain there until the key is superseded by using this same command, or with the 'config key' command which is explained further along in this article.
The application will now be running in your terminal window.
ns1 CLI version x.y Type 'help' for help Current Key: default Endpoint: https://api.nsone.net/v1/ ns1>
|Create, retrieve, update, and delete records in a zone|
|View and manipulate configuration settings|
|Get help on a command|
|Create, retrieve, update, and delete zone SOA data|
|Retrieve real time queries per second|
The following functions can be invoked with the record call:
record info ZONE DOMAIN TYPE record create [options] [--] ZONE DOMAIN TYPE ([--priority=<p>] ANSWER)... record delete [-f] ZONE DOMAIN TYPE record link ZONE SOURCE_DOMAIN DOMAIN TYPE record set ZONE DOMAIN TYPE options record meta set ZONE DOMAIN TYPE KEY VALUE record meta remove ZONE DOMAIN TYPE KEY VALUE record answer add ZONE DOMAIN TYPE [--priority=<p>] ANSWER record answer remove ZONE DOMAIN TYPE ANSWER record answer meta set ZONE DOMAIN TYPE ANSWER KEY VALUE record answer meta remove ZONE DOMAIN TYPE ANSWER KEY record answers ZONE DOMAIN TYPE [options] (ANSWER ...)
The following functions can be invoked with the config call:
config show config key KEYID
The following functions can be invoked with the help call:
The following functions can be invoked with the zone call:
zone list zone info ZONE zone create ZONE [-f] [options] zone delete [-f] ZONE zone set ZONE [-f] [options]
The following functions can be invoked with the qps call:
qps qps ZONE
Open Source Contribution
We will be making improvements and enhancements to this utility over the course of time, but your input is key to getting us motivated! Feel free to contact us, or submit your own pull requests.
Pull requests can be made from a fork of the ns1cli repository, into a branch other than master. You can access the source on NS1's GitHub.