0% found this document useful (0 votes)
34 views

Step 2: Create An API Token: To Install The Latest Version of Using Snap On Ubuntu Or, Run

This document provides instructions for installing and configuring the doctl command line tool to manage DigitalOcean resources. It outlines the following steps: 1. Install doctl using Snap on Ubuntu or other supported OS with "sudo snap install doctl". Additional permissions may be needed for specific doctl commands. 2. Create a DigitalOcean API token with read and write access from the control panel. 3. Use the API token to authorize doctl with "doctl auth init" and provide the context name. Multiple accounts can be added. 4. Validate doctl is working by checking account details with "doctl account get" and creating/deleting a test Droplet.

Uploaded by

Fernando Herrera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Step 2: Create An API Token: To Install The Latest Version of Using Snap On Ubuntu Or, Run

This document provides instructions for installing and configuring the doctl command line tool to manage DigitalOcean resources. It outlines the following steps: 1. Install doctl using Snap on Ubuntu or other supported OS with "sudo snap install doctl". Additional permissions may be needed for specific doctl commands. 2. Create a DigitalOcean API token with read and write access from the control panel. 3. Use the API token to authorize doctl with "doctl auth init" and provide the context name. Multiple accounts can be added. 4. Validate doctl is working by checking account details with "doctl account get" and creating/deleting a test Droplet.

Uploaded by

Fernando Herrera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 2

To install the latest version of 

doctl  using Snap on Ubuntu or other supported operating


systems, run:
sudo snap install doctl
Copy

For security purposes, Snaps run in complete isolation and need to be granted permission
to interact with your system’s resources. Some  doctl  commands require additional
permissions:
• Using  doctl ’s integration with  kubectl  requires the  kube-config  personal-files interface. To
enable it, run:
sudo snap connect doctl:kube-config
Copy

• Using  doctl compute ssh  requires the core ssh-keys interface. To enable it, run:

sudo snap connect doctl:ssh-keys :ssh-keys


Copy

• Using  doctl registry login  requires the  dot-docker  personal-files interface. To enable it,
run:
sudo snap connect doctl:dot-docker
Copy

Step 2: Create an API token


Create a DigitalOcean API token for your account with read and write access from
the Applications & API page in the control panel. The token string is only displayed once,
so save it in a safe place.

Step 3: Use the API token to grant account access to doctl


 Note
If you installed  doctl  using the Ubuntu Snap package, you may need to first create the user
configuration directory if it does not exist yet by running  mkdir ~/.config .

Use the API token to grant doctl access to your DigitalOcean account. Pass in the token
string when prompted by  doctl auth init , and give this authentication context a name.
doctl auth init --context <NAME>
Copy
Authentication contexts let you switch between multiple authenticated accounts. You can
repeat steps 2 and 3 to add other DigitalOcean accounts, then list and switch between
authentication contexts:
doctl auth list
doctl auth switch --context <NAME>
Copy

Step 4: Validate that doctl is working


Now that  doctl  is authorized to use your account, try some test commands.
To confirm that you have successfully authorized  doctl , review your account details by
running:
doctl account get
Copy

If successful, the output will look like:


Email Droplet Limit Email Verified UUID
Status
[email protected] 10 true
3a56c5e109736b50e823eaebca85708ca0e5087c active
Copy

To confirm that you have successfully granted write access to  doctl , create an Ubuntu
18.04 Droplet in the SFO2 region by running:
doctl compute droplet create --region tor1 --image ubuntu-18-04-x64 --size s-1vcpu-
1gb <DROPLET-NAME>
Copy

The output of that command will include an ID column with the new Droplet’s ID. For
example:
ID Name Public IPv4 Private IPv4 Public IPv6 Memory
VCPUs Disk Region Image Status Tags Features
Volumes
187949338 droplet-name 1024
1 25 sfo2 Ubuntu 18.04.3 (LTS) x64 new
Copy

Use that value to delete the Droplet by running:


doctl compute droplet delete <DROPLET-ID>
Copy

When prompted, type  y  to confirm that you would like to delete the Droplet.

You might also like