2. Two ways for Digitalocean command line
doctl:
https://docs.digitalocean.com/reference/doctl/how-to/install/
HTTP API:
https://docs.digitalocean.com/reference/api/
But actually a few other methods exists:
https://docs.digitalocean.com/reference/
5. doctl examples
Install
sudo snap install doctl # Linux
Authenticate doctl
doctl auth init
List Droplets
doctl compute droplet list
Create a Droplet
doctl compute droplet create my-droplet --size s-1vcpu-1gb --image ubuntu-20-04-x64 --region nyc1
Delete a Droplet
doctl compute droplet delete DROPLET_ID
Retrieve Information About a Droplet
doctl compute droplet get DROPLET_ID
List Domains
doctl compute domain list
6. doctl examples (II)
Create a Domain
doctl compute domain create example.com --ip-address
DROPLET_IP
Delete a Domain
doctl compute domain delete example.com
List DNS Records
doctl compute domain records list example.com
Create a DNS Record
doctl compute domain records create example.com --record-type A
--record-name www --record-data DROPLET_IP
Delete a DNS Record
doctl compute domain records delete example.com RECORD_ID
List SSH Keys
doctl compute ssh-key list
Add an SSH Key
doctl compute ssh-key import --public-key-file ~/.ssh/id_rsa.pub --
name my-key
Delete an SSH Key
doctl compute ssh-key delete SSH_KEY_ID
List Images
doctl compute image list
Retrieve Information About an Image
doctl compute image get IMAGE_ID
Delete an Image
doctl compute image delete IMAGE_ID
List Sizes
doctl compute size list
List Regions
doctl compute region list
List Volumes
doctl compute volume list
Create a Volume
doctl compute volume create --region nyc1 --size 10GiB --name
my-volume
Attach a Volume to a Droplet
doctl compute volume-action attach VOLUME_ID DROPLET_ID
Detach a Volume from a Droplet
doctl compute volume-action detach VOLUME_ID
Resize a Volume
doctl compute volume resize VOLUME_ID --size 20GiB
Delete a Volume
doctl compute volume delete VOLUME_ID
List Snapshots
doctl compute snapshot list
Create a Snapshot of a Droplet
doctl compute droplet snapshot DROPLET_ID --snapshot-name
my-snapshot
Delete a Snapshot
doctl compute snapshot delete SNAPSHOT_ID
Retrieve Account Information
doctl account get