Skip to content

Instantly share code, notes, and snippets.

@rgodishela
Created April 23, 2017 16:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rgodishela/428c03487300ed86a93c8e6f5730b0b1 to your computer and use it in GitHub Desktop.
Save rgodishela/428c03487300ed86a93c8e6f5730b0b1 to your computer and use it in GitHub Desktop.
Digital Ocean Command Line Interface
DOCTL
Installation
Option 1 – Download a Release from GitHub
Visit the Releases page for the doctl GitHub project.
https://github.com/digitalocean/doctl/releases
tar xf ~/doctl-1.4.0-linux-amd64.tar.gz
sudo mv ~/doctl /usr/local/bin
Configure
doctl auth init
Configuration Files
On OS X and Linux: ~/.config/doctl/config.yaml.
For Windows users: %APPDATA%/doctl/config/config.yaml.
Invoking Commands
doctl: To see available commands under a particular grouping, enter it by itself:
doctl compute:
doctl compute droplet:
doctl compute droplet list
doctl compute droplet create test --size 1gb --image debian-8-x64 --region nyc1 --ssh-keys 4d:23:e6:e4:8c:17:d2:cf:89:47:36:b5:c7:33:40:4e --enable-backups
Finding Unique Identifiers for Droplets, Images, SSH Keys, Regions, etc.
doctl compute droplet list
doctl compute ssh-key list
doctl compute region list
doctl compute image list
doctl compute size list
doctl compute action list
doctl account get
doctl account ratelimit
doctl compute droplet get droplet_id --output json
Creating, Deleting, and Inspecting Droplets
doctl compute droplet actions droplet_id
doctl compute droplet backups droplet_id
doctl compute droplet create name --size 1gb --image image_slug --region nyc1 --ssh-keys ssh_key_fingerprint
doctl compute droplet delete droplet_id
doctl compute droplet get droplet_id
doctl compute droplet kernels droplet_id
doctl compute droplet list
doctl compute droplet neighbors droplet_id
doctl compute droplet snapshots droplet_id
Initiating Droplet Actions
doctl compute droplet-action disable-backups droplet_id
doctl compute droplet-action reboot droplet_id
doctl compute droplet-action power-cycle droplet_id
doctl compute droplet-action shutdown droplet_id
doctl compute droplet-action power-off droplet_id
doctl compute droplet-action power-on droplet_id
doctl compute droplet-action power-reset droplet_id
doctl compute droplet-action enable-ipv6 droplet_id
doctl compute droplet-action enable-private-networking droplet_id
doctl compute droplet-action restore droplet_id --image-id image_id
doctl compute droplet-action resize droplet_id --size 2gb --resize-disk
doctl compute droplet-action rebuild droplet_id --image-id image_id
doctl compute droplet-action rename droplet_id --droplet-name new_name
doctl compute droplet-action change-kernel droplet_id--kernel-id kernel_id
doctl compute droplet-action snapshot droplet_id --snapshot-namesnapshot_name
Making SSH Connections
doctl compute ssh droplet_name
doctl compute ssh droplet_id
Working with SSH Keys
doctl compute ssh-key list
doctl compute ssh-key get ssh_key_id
doctl compute ssh-key get ssh_key_fingerprint
doctl compute ssh-key create new_key_name --public-key "public_key"
doctl compute ssh-key import new_key_name --public-key-file~/.ssh/id_rsa.pub
doctl compute ssh-key delete ssh_key_id
doctl compute ssh-key delete ssh_key_fingerprint
doctl compute ssh-key update ssh_key_id --key-namenew_key_name
doctl compute ssh-key update ssh_key_fingerprint --key-namenew_key_name
Working with Floating IPs
doctl compute floating-ip create --region nyc1
doctl compute floating-ip get floating_ip_address
doctl compute floating-ip delete floating_ip_address
doctl compute floating-ip list
Working with Domains
doctl compute domain create domain_name --ip-addressdroplet_ip_address
doctl compute domain list
doctl compute domain get domain_name
doctl compute domain delete domain_name
doctl compute domain records list --domain-name domain_name
Creating, Deleting, and Inspecting Block Storage Volumes
doctl compute volume create volume_name --region volume_region --sizevolume_size --desc volume_description
doctl compute volume list
doctl compute volume get volume_ID
doctl compute volume delete volume_ID
doctl compute volume-action attach volume_id droplet_id
doctl compute volume-action detach volume_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment