Digital Ocean CLI

Digital Ocean CLI

I’m using DIgital Ocean for DNS records management. CLI tool can help us with that.

Install the CLI:

1
2
3
4
5
6
7
8
9
# install
sudo GOBIN=/usr/local/bin go get -u github.com/digitalocean/doctl/cmd/doctl

# initialize with API token
doctl auth init

# implement completion
doctl completion bash | sudo tee /etc/bash_completion.d/doctl
# probably must relogin

Note: I was required to update to latest Golang version, due the some error “undefined: os.UserConfigDir” during CLI install

View account settings with: doctl account get

DNS updates via CLI

Using CLI, let’s try to create a new A record for an existing domain:

doctl compute domain list
doctl compute domain records create --record-type A --record-name www --record-data <ip-addr> <domain-name>
date 27. Sep 2019 | modified 10. Jun 2024
filename: Hosting » Digital Ocean