Digital Ocean Command Line Interface.
Docli is Digital Ocean command line interface written in Click, Using docli you can create, update and delete droplets and various actions on droplets like resize, rename, backup, snapshot etc.
Install:
$ git clone https://github.com/yspanchal/docli.git
$ cd docli/
$ python setup.py install
or
pip install docli
Usage:
Obtain access token from digital ocean
Digital Ocean Access Token Click Here
Configure Docli
docli --configure
Enter digital ocean access token and press enter.
Get Help
docli --help
Get Account Info
docli account
Get list of actions or events that have occurred on the resources
docli action -l
Retrieve a specific action object
docli action -r 3010215
Where,
-r is action id to be retrieved (Required)
Get list of all domain configured with Digital Ocean
docli domain -l
Create new domain name record
docli domain -c -n example.com -i 101.101.101.101
Where,
-c is create new domain name entry (Required)
-n is name of domain name (Required)
-i ip address for domain name (Required)
Get details of existing domain name
docli domain -d 3010215
Where,
-d is domain id to get details (Required)
Delete existing domain name
docli domain -r 3010215
Where,
-r is domain id to be deleted (Required)
Get list of all domain records
docli record -l
Create new record for domain name
docli record -c mydomain.com -y CNAME -n xyz.mydomain.com -w 101.101.101.101
Where,
-c is domain name for which record to be created (Required)
-y is type of record A, CNAME, MX (Required)
-n is host name, alias, or service being defined by the record (Required)
-w is variable data depending on record type (Required)
-x is priority of the host (for SRV and MX records. null otherwise) (Optional)
-P is port that the service is accessible on (for SRV records only. null otherwise) (Optional)
-g The weight of records with the same priority (for SRV records only. null otherwise) (Optional)
Update existing record for domain name
docli record -u mydomain.com -n xyz.mydomain.com -w 101.101.101.101
Where,
-u is domain name for which record to be updated (Required)
-y is type of record A, CNAME, MX (Optional)
-n is host name, alias, or service being defined by the record (Optional)
-w is variable data depending on record type (Optional)
-x is priority of the host (for SRV and MX records. null otherwise) (Optional)
-P is port that the service is accessible on (for SRV records only. null otherwise) (Optional)
-g The weight of records with the same priority (for SRV records only. null otherwise) (Optional)
Delete existing record for domain name
docli record -r mydomain.com -i 3812352
Where,
-r is domain name for which record to be deleted (Required)
-i is record id to be deleted (Required)
Create new droplet
docli droplet -n example-server -s 1gb -r nyc1 -i ubuntu-14-04-x64 -S 10201 -b False -I True -P False -u 'apt-get update'
Where,
-n is name of droplet to be created (Required)
-s is size of droplet to be created (Required)
-r is region in which droplet to be created (Required)
-i is image slug used to created droplet (Required)
-S is sshkey id to be included (Optional)
-b is boolean automated backups should be enabled (Optional)
-I is boolean ipv6 should be enabled (Optional)
-u is user data for droplet (Optional)
-P is boolean private networking should be enabled (Optional)
Get details of specific droplet
docli droplet -R 30102012
Where,
-R is droplet id to get details (Required)
Get list of all droplets
docli droplet -l
Get list of available kernels for droplet
docli droplet -k 30102012
Where,
-k is droplet id to get kernels (Required)
Get list of available snapshots for droplet
docli droplet -C 30102012
Where,
-C is droplet id to get snapshots (Required)
Get list of available backups for droplet
docli droplet -B 30102012
Where,
-B is droplet id to get backups (Required)
Get list of actions for droplet
docli droplet -a 30102012
Where,
-a is droplet id to get actions (Required)
Disable backup for droplet
docli droplet-actions -d 30102012
Where,
-d is droplet id to disable backups (Required)
Reboot a droplet
docli droplet-actions -r 30102012
Where,
-r is droplet id to be rebooted (Required)
Power cycle a droplet
docli droplet-actions -P 30102012
Where, power cycle is power off and then back on
-P is droplet id to be power cycle (Required)
Shutdown a droplet
docli droplet-actions -s 30102012
Where,
-s is droplet id to be shutdown (Required)
Power-Off a droplet
docli droplet-actions -O 30102012
Where,
-O is droplet id to be power-off (Required)
Power-On a droplet
docli droplet-actions -o 30102012
Where,
-o is droplet id to be power-on (Required)
Password reset droplet
docli droplet-actions -w 30102012
Where,
-w is droplet id to be password reset (Required)
Enable ipv6 for droplet
docli droplet-actions -v 30102012
Where,
-v is droplet id to enable ipv6 (Required)
Enable private networking for droplet
docli droplet-actions -n 30102012
Where,
-n is droplet id to enable private networking (Required)
Upgrade droplet
docli droplet-actions -u 30102012
Where,
-u is droplet id to be upgraded (Required)
Restore droplet from given image
docli droplet-actions -R 30102012 -b 3812352
Where,
-R is droplet id to be restored (Required)
-b is backup id from which droplet restored (Required)
Resize droplet
docli droplet-actions -z 30102012 -S 2gb
Where,
-z is droplet id to be resized (Required)
-S is size (Required)
Rebuild droplet
docli droplet-actions -B 30102012 -i 1214392 or ubuntu-14-04-x64
Where,
-B is droplet id to be rebuild (Required)
-i is image id or image slug from which droplet is rebuild (Required)
Rename droplet
docli droplet-actions -m 30102012 -N My-server
Where,
-m is droplet id to be rename (Required)
-N is new name for droplet (Required)
Change kernel of droplet
docli droplet-actions -c 30102012 -k 3812352
Where,
-c is droplet id for which kernel to be changed (Required)
-k is new kernel id for droplet (Required)
Create snapshot for droplet
docli droplet-actions -a 30102012 -A my-server-snapshot
Where,
-a is create snaphot of given droplet id (Required)
-A is name of snapshot to be created (Required)
Transfer image from one region to another region
docli image-actions -T 30102012 -r nyc3
Where,
-T is image id to be transfered (Required)
-r is region where image to be transfered (Required)
Convert backup image to snapshot image
docli image-actions -c 30102012
Where,
-c is image id to be convert (Required)
Get details of action or event executed on image
docli image-actions -a 30102012 -i 3812352
Where,
-a is image id (Required)
-i is action id (Required)
Get list of all images
docli images -l
Get list of distribution images
docli images -d
Get list of application images
docli images -a
Get list of user's private images
docli images -p
Get image details using image id
docli images -I 3812352
Where,
-I is image id (Required)
Get image details using image slug
docli images -S my-fancy-image
Where,
-S is image slug (Required)
Get all actions that have been executed on an image
docli images -A 3812352
Where,
-A is image id (Required)
Update image name
docli images -u 3812352 -n New-Image-Name
Where,
-u is image id to be updated (Required)
-n is new image name (Required)
Delete image
docli images -D 3812352
Where,
-D is image id to be deleted (Required)
Get list of all ssh keys
docli ssh-key -l
Add new ssh key
docli ssh-key -c -n my-office-key -k ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCcs8EG24p2hy....
Where,
-c is add new ssh key (Required)
-n is name of ssh key (Required)
-k is public ssh key string (Required)
Get details of existing ssh key
docli ssh-key -r 3020321
Where,
-r is id of ssh key (Required)
Update ssh key
docli ssh-key -u 3020321 -n my-office-key -k ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCcs8EG24p2hy....
Where,
-u is id of ssh key to be updated (Required)
-n is name of ssh key (Optional)
-k is public ssh key string (Optional)
Delete existing ssh key
docli ssh-key -d 3020321
Where,
-d is id of ssh key to be deleted (Required)
Get available regions list
docli info -r
Get available droplet sizes list
docli info -s
Having issue's with docli? Check out issue's Docli Issue's or contact yspanchal@gmail.com and i’ll help you out.