---
title: "doctl DigitalOcean CLI : An Overview Guide"
description: "Learn to use the doctl DigitalOcean CLI with this ATA Learning tutorial. Whether a beginner or an expert, this guide helps get you on your way!"
canonical: "https://adamtheautomator.com/doctl/"
---

# doctl DigitalOcean CLI : An Overview Guide

> Learn to use the doctl DigitalOcean CLI with this ATA Learning tutorial. Whether a beginner or an expert, this guide helps get you on your way!

Source: https://adamtheautomator.com/doctl/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Getting Started with the doctl DigitalOcean CLI](https://adamtheautomator.com/wp-content/uploads/2023/04/doctl.jpg)

# Getting Started with the doctl DigitalOcean CLI

[![](https://secure.gravatar.com/avatar/1bc5e1d52466fc3739f550c8d78be310684747bf1466a98d698320627ea243e2?s=192&d=mm&r=g)Michael Nguyen Tu](https://adamtheautomator.com/author/michael-nguyen-tu/)12 April 20235 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Command Line](/tag/command-line/)[Digital Ocean](/tag/digital-ocean/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Downloading and Installing doctl](#downloading-and-installing-doctl)
*   [Retrieving An API Access Token](#retrieving-an-api-access-token)
*   [Authenticating DigitalOcean Accounts With doctl](#authenticating-digitalocean-accounts-with-doctl)
*   [Creating a Droplet via doctl](#creating-a-droplet-via-doctl)
*   [Creating a Database Cluster](#creating-a-database-cluster)
*   [Conclusion](#conclusion)

DigitalOcean, like other cloud platforms, has been progressively crucial to deploying, managing, and scaling applications. But how exactly? DigitalOcean lets you manage and interact with your resources via the DigitalOcean CLI (doctl).

In this tutorial, you will learn to install doctl, authorize your DigitalOcean account, and quickly manage your DigitalOcean resources.

Stay tuned, and effectively manage your resources!

## Prerequisites

This tutorial comprises hands-on demonstrations. To follow along, ensure you have the following in place:

*   A DigitalOcean account with active billing enabled – A [free trial account](https://try.digitalocean.com/freetrialoffer/) is sufficient.
*   A system running Linux, macOS, or Windows – This tutorial uses Ubuntu 20.04.

Related:[How to Install Ubuntu 20.04 \[Step-by-Step\]](https://adamtheautomator.com/install-ubuntu/)

## Downloading and Installing `doctl`

As a developer or system administrator, managing and interacting with DigitalOcean resources from a command-line environment is a powerful and flexible option. The same goes with doctl, making it a valuable addition to your toolkit.

But before taking advantage of doctl, you must first download and install it on your system, as follows:

1\. Open a terminal, and run the following [`snap`](https://snapcraft.io/docs/installing-snap-on-ubuntu) command to `install` `doctl`.

```powershell
sudo snap install doctl
```

The output below indicates you have successfully installed doctl on your Ubuntu system. At this time of writing, v1.93.1 is the latest version of doctl.

![Downloading and installing doctl](https://adamtheautomator.com/wp-content/uploads/2023/04/image-41.png)

Downloading and installing doctl

2\. Next, run the following commands, which do not provide output but enable different interfaces, and connect the doctl snap to each interface below: Interface.

| Interface | Details |
| --- | --- |
| `ssh-keys` | This interface is required to use the `doctl compute` subcommand. |
| `dot-docker` | This interface is a part of the Ubuntu Snap system, which provides a secure way to store and access personal files related to Docker. In addition, it allows you to authenticate with the DigitalOcean Container Registry securely. |
| `kube-config` | This interface allows you to use doctl’s integration with `kubectl` and manage your DigitalOcean [Kubernetes](https://adamtheautomator.com/aws-eks-cli/) cluster. |

Related:[Docker on Windows? Get Started Learning Now!](https://adamtheautomator.com/docker-windows/)

Related:[How to Create a Kubernetes Cluster With the AWS EKS CLI](https://adamtheautomator.com/aws-eks-cli/)

```bash
# Connect doctl snap to ssh-keys interface
sudo snap connect doctl:ssh-keys :ssh-keys
# Connect doctl snap to dot-docker interface
sudo snap connect doctl:dot-docker
# Connect doctl snap to kube-config interface
sudo snap connect doctl:kube-config
```

3\. Ultimately, run the `doctl` command below to verify the installation was successful.

```bash
doctl
```

With a successful doctl installation, you will get the following output.

![Verifying successful doctl installation and configuration](https://adamtheautomator.com/wp-content/uploads/2023/04/image-42.png)

Verifying successful doctl installation and configuration

## Retrieving An API Access Token

You have successfully installed doctl on your system, but can you already manage your DigitalOcean resources? Well, not yet, unless you have access to DigitalOcean’s API. You must first retrieve an API access token authenticate, and access the API endpoints.

With an API access token, developers can programmatically manage and interact with DigitalOcean resources. These resources include but are not limited to Droplets (VMs), Kubernetes clusters, load balancers, storage volumes, and more.

Related:[Learn How to Create & Manage VPS DigitalOcean VMs](https://adamtheautomator.com/vps-digitalocean/)

To retrieve an API access token, follow these steps:

1\. Open your favorite web browser, log in to your DigitalOcean console, and navigate to [the API page](https://cloud.digitalocean.com/account/api/tokens).

2\. On the API page, look **Generate New Token** (upper-right) to initiate creating a new API access token.

![Initiating creating a new API access token](https://adamtheautomator.com/wp-content/uploads/2023/04/image-43.png)

Initiating creating a new API access token

3\. Next, configure the API access token with the following:

*   **Token name** – Provide a descriptive name (i.e., **doctl\_demo**) for the API access token to distinguish between multiple tokens.
*   **Expiration** – Set the length of time your API access token is valid. This option increases your DigitalOcean account’s and resources’ security.
*   **Select scopes** – Set the permissions to grant your API access token. By selecting the appropriate scopes, you can control the token’s actions.

Once configured, click **Generate Token** to finalize creating the API access token.

![Configuring and creating a new API access token](https://adamtheautomator.com/wp-content/uploads/2023/04/image-44.png)

Configuring and creating a new API access token

4\. Lastly, write down the API access token from the list, as shown below, in a secure place, such as a password manager or encrypted file, for later use.

Related:[Secure Your Passwords with the Padloc Password Manager](https://adamtheautomator.com/padloc/)

Once you close the token generation page or navigate away, the token will no longer be displayed on the screen. This security measure prevents unauthorized access to your account and resources.

![Taking note of the API access token](https://adamtheautomator.com/wp-content/uploads/2023/04/image-45.png)

Taking note of the API access token

## Authenticating DigitalOcean Accounts With `doctl`

With an API access token at your disposal, you can move on to authenticating your DigitalOcean account with doctl. In the context of DigitalOcean and doctl, authentication involves providing your API access token to doctl to make requests on your behalf.

To authenticate your DigitalOcean account with doctl:

1\. Run the below command, which does not produce output but creates a config directory (`mkdir`) named `.config` in your home directory (`~/`). This _`.config`_ directory stores the doctl configuration file.

```bash
mkdir ~/.config
```

2\. Next, run the below [`doctl auth`](https://docs.digitalocean.com/reference/doctl/reference/auth/) command to initiate ([`init`](https://docs.digitalocean.com/reference/doctl/reference/auth/init/)) an authentication session with DigitalOcean via doctl. Replace `doctl_demo` with your desired name for the session.

```bash
doctl auth init --context doctl_demo
```

When prompted, provide your API access token to authenticate your DigitalOcean account with the doctl. After authenticating, doctl creates a local configuration file that stores your access token and saves it in the newly-created `~/.config/` directory.

![Authenticating the DigitalOcean account via doctl with the API access token](https://adamtheautomator.com/wp-content/uploads/2023/04/image-46.png)

Authenticating the DigitalOcean account via doctl with the API access token

3\. Once authentication completes, run the following [`auth list`](https://docs.digitalocean.com/reference/doctl/reference/auth/list/) command to list all the tokens associated with your DigitalOcean account.

```bash
doctl auth list
```

Below are two associated tokens associated with your DigitalOcean account, as shown below.

![Listing all API access tokens associated with the DigitalOcean account](https://adamtheautomator.com/wp-content/uploads/2023/04/image-47.png)

Listing all API access tokens associated with the DigitalOcean account

4\. Now, run the `account get` command below to confirm that you have successfully authenticated `doctl` with your DigitalOcean account. This command displays the authenticated DigitalOcean account information, including the user UUID, email address, and status.

```bash
doctl account get
```

![Confirming the DigitalOcean account is successfully authenticated](https://adamtheautomator.com/wp-content/uploads/2023/04/image-48.png)

Confirming the DigitalOcean account is successfully authenticated

## Creating a Droplet via `doctl`

After configuring the doctl, you are set to use the tool to manage DigitalOcean resources. One of the basic features doctl offers is creating a Droplet that runs on DigitalOcean’s cloud infrastructure.

Run the below command to create a new Droplet (`compute droplet create`) called `doctl-demo` (arbitrary) with the specified configuration parameters as follows:

*   `--region` – Specifies the [DigitalOcean region](https://slugs.do-api.dev/) where to create the Droplet, which is New York City 1 (`nyc1`).
*   `--image` – Specifies [the image](https://slugs.do-api.dev/) used to create the Droplet. In this case, the image is Ubuntu 18.04 LTS 64-bit (`ubuntu-18-04-x64`).
*   `--size` – Specifies [the Droplet size](https://slugs.do-api.dev/), which in this case, is 1 virtual CPU, 1 GB of RAM, and 25GB of disk (`s-1vcpu-1gb`).

```bash
doctl compute droplet create --region nyc1 --image ubuntu-18-04-x64 --size s-1vcpu-1gb doctl_demo
```

![Creating a Droplet via doctl](https://adamtheautomator.com/wp-content/uploads/2023/04/image-49.png)

Creating a Droplet via doctl

Now, navigate to the DigitalOcean console to see the newly-created Droplet.

![Verifying the newly-created droplet](https://adamtheautomator.com/wp-content/uploads/2023/04/image-50.png)

Verifying the newly-created droplet

> _You may want to delete unused Droplets to prevent accruing unnecessary charges. If so, run the `doctl` command below. But ensure you replace `doctl-demo` with your Droplet’s name. `doctl compute droplet delete doctl-demo`_

![Deleting a Droplet](https://adamtheautomator.com/wp-content/uploads/2023/04/image-51.png)

Deleting a Droplet

## Creating a Database Cluster

Besides creating a Droplet, you can also create a database cluster with doctl. A database cluster is a group of nodes that work together to provide a scalable, highly available, and reliable database service.

Run the following [`databases create`](https://docs.digitalocean.com/reference/doctl/reference/databases/create/) command to create a [Redis Database Cluster](https://docs.redis.com/latest/rs/databases/durability-ha/clustering/) (`redis`) named `db-demo` with specifications as follows:

*   Region – Default region (nyc1).
*   Size – Default size (1 GB RAM / 1vCPU / 10 GB Disk).
*   Version – The latest Redis version (Redis 7).

Related:[How to Perform a Secure Redis Install on Linux](https://adamtheautomator.com/redis-install/)

> _[DigitalOcean’s Managed Databases](https://docs.digitalocean.com/products/databases/) service allows you to create and manage PostgreSQL, MySQL, and Redis clusters. All these use a simple and intuitive interface or API requests via the doctl._

```bash
doctl databases create db-demo --engine redis
```

![Creating a database cluster](https://adamtheautomator.com/wp-content/uploads/2023/04/image-52.png)

Creating a database cluster

Finally, navigate to your DigitalOcean console to verify the newly-created database cluster (**de-demo**), as shown below.

![Navigate to the console to see the Database Cluster created.](https://adamtheautomator.com/wp-content/uploads/2023/04/image-53.png)

Navigate to the console to see the Database Cluster created.

## Conclusion

In this tutorial, you learned how to install, configure, and use doctl to manage Droplets and database clusters on DigitalOcean. With an API access token and an authorized DigitalOcean account, you could securely create and manage your resources quickly.

You have seen how doctl is a powerful and efficient way to manage your DigitalOcean resources. But why not explore other commands available to manage DigitalOcean resources? Perhaps learn [how to manage a Kubernetes cluster](https://docs.digitalocean.com/reference/doctl/reference/kubernetes/)?

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fdoctl%2F&text=Getting%20Started%20with%20the%20doctl%20DigitalOcean%20CLI)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fdoctl%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fdoctl%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26989-monitor-windows-servers-prometheus-grafana-codex.webp)

### [How to Monitor Windows Servers with Prometheus and Grafana](/monitor-windows-servers-prometheus-grafana/)

Set up Windows Server monitoring with windows\_exporter, Prometheus, Grafana, and Alertmanager. Learn how to secure port 9182, scrape targets, and validate alerts.

![](https://adamtheautomator.com/wp-content/uploads/2026/05/featured_image-11.webp)

### [How to Troubleshoot Active Directory Replication Errors](/troubleshoot-active-directory-replication-errors/)

Troubleshoot Active Directory replication errors by isolating 1311, 1722, 2087, and USN rollback issues with repadmin, dcdiag, DNS, RPC, and KCC checks.

![](https://adamtheautomator.com/wp-content/uploads/2026/04/featured_image-6.webp)

### [How to Survive the 2026 Secure Boot Certificate Expiry](/survive-2026-secure-boot-certificate-expiry-3/)

Deploy Windows UEFI CA 2023 before the June 2026 certificate expiry. Inventory devices, update OEM firmware, and trigger enrollment via Intune or PowerShell registry settings.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
