Installing doctl
brew install doctl
brew install bash-completion
source $(brew --prefix)/etc/bash_completion
source ~/.bashrc
Upgrading doctl
Authenticating with DigitalOcean
doctl auth init
# You should get someting like this
# 6f600d1e574f4f5c2a3ce558db898581d190d7cbc68f5a57692104bf50fd5d2f
Droplets
List all Droplets
doctl compute droplet list
Create a Droplet
doctl compute droplet create <name> --region <region-slug> --image <image-slug> --size <size-slug>
doctl compute droplet create pythontesting --wait --region fra1 --image 56427524 --size s-1vcpu-2gb --ssh-keys 25855785
#DO_IMAGE_ID=`doctl compute image list --public | grep ubuntu-18-04-x64 | grep "18.04.3 (LTS) x64" | cut -f1 -d' '`
DO_REGION=`doctl compute region list | grep "Toronto 1" | cut -f1 -d' '`
DO_IMAGE_ID=`doctl compute image list --public | grep debian-10-x64 | cut -f1 -d' '`
DO_VM_SIZE=g-2vcpu-8gb
DO_VM_NAME=gitlab.obay.cloud
doctl compute droplet create --wait $DO_VM_NAME --region $DO_REGION --image $DO_IMAGE_ID --size $DO_VM_SIZE --ssh-keys 25855785
doctl compute ssh $DO_VM_NAME
Delete a Droplet
doctl compute droplet delete 173281908
Get Droplets Details
doctl compute droplet get 173281908
SSH to Droplet
doctl compute ssh pythontesting
Regions
List all regions
doctl compute region list
Images
List all public images
doctl compute image list --public | grep debian
# 53893565 ubuntu-14-04-x64
# 53893572 ubuntu-18-04-x64
Sizes
List all sizes
List K8s Clusters on DigitalOcean
doctl kubernetes cluster list