The complete guide to doctl, the DigitalOcean CLI

By

Updated

Tagged: CLI

Learn doctl with practical tutorials for Droplets, firewalls, DNS, databases, App Platform, Kubernetes, storage, Functions, AI services, and automation.

DigitalOcean has a command line tool called doctl. You can use it to create a server, deploy an application, manage a database, or find out which resources are running in your account.

Once you know the commands, you can put them in a script and repeat a deployment from your terminal instead of clicking through the dashboard.

We’ll install and authenticate, then build a small web server from beginning to end. The later sections are independent examples for App Platform, Kubernetes, storage, AI services and the rest, so skip the ones you don’t need.

The command names and flags follow DigitalOcean’s current doctl reference. Some newer commands need a recent installation, and availability and prices depend on your account and region.

Creating resources costs money. Check the selected plan before running a create command, and use the cleanup section when you’re finished. Turning a server off does not stop its charges.

What can you do with doctl?

A Droplet is DigitalOcean’s name for a virtual server, but doctl covers most of the platform.

What you want to manageCommand groupExamples
Virtual serverscompute droplet, compute droplet-actionCreate, resize, restart, snapshot, delete
Server accesscompute ssh-key, compute sshUpload public keys, connect over SSH
Networkingvpcs, compute firewall, compute load-balancerPrivate networks, traffic rules, load balancing
DNS and certificatescompute domain, compute certificateDNS records, managed TLS certificates
Storagecompute volume, nfs, spaces keysBlock volumes, shared filesystems, object-storage keys
ApplicationsappsDeploy from a spec, inspect deployments, stream logs
Managed databasesdatabasesPostgreSQL and other engines, users, pools, replicas
Containersregistries, registryRegistry credentials, repositories, image tags
KuberneteskubernetesClusters, node pools, kubeconfig, upgrades
FunctionsserverlessDeploy functions, invoke them, inspect executions
SecretssecretsStore key-value pairs, retrieve values, manage versions
Monitoring and securitymonitoring, securityResource alerts, uptime checks, posture scans
AI infrastructureserverless-inference, dedicated-inferenceModel requests and dedicated endpoints
AI data and evaluationknowledge-base, vector-databases, evaluation, signalsRetrieval data, evaluations, collected interaction data
Hosted coding agentsharness-runtimeCreate sessions, send prompts, inspect sandboxes
Organization and billingprojects, account, balance, invoiceGroup resources, inspect quotas, retrieve billing details

doctl talks to DigitalOcean’s APIs. For jobs inside a server, you still use SSH, your package manager, and your database client.

Where doctl fits in a deploymentUse doctl with account credentials to create or inspect resources through DigitalOcean APIs. Then use a service-specific client for work inside the resource or with its data.Your terminaldoctlDigitalOcean APIsCreate or inspectresourcesUse the appropriateclientSSH, kubectl, or anS3 client

doctl creates a database cluster, and you use psql to run SQL inside it. doctl creates a Kubernetes cluster, and kubectl manages its workloads.

Install doctl

On macOS, use Homebrew:

brew install doctl

If it’s already installed, update it:

brew upgrade doctl

On Ubuntu with Snap:

sudo snap install doctl

The Snap package is isolated, so grant these connections when you need SSH, Kubernetes configuration, or Docker authentication:

sudo snap connect doctl:ssh-keys :ssh-keys
sudo snap connect doctl:kube-config
sudo snap connect doctl:dot-docker

On Windows, or Linux without Snap, download the archive for your operating system and CPU from the official releases. Extract it and put the doctl executable in a directory on your PATH.

doctl runs in PowerShell too, but the scripts below use Bash syntax, so use WSL or adapt them.

Check that your terminal can find the program:

doctl version

If you get command not found, check your PATH and open a new terminal after changing it.

Authenticate with DigitalOcean

You need a DigitalOcean account. If you need to create one, you can use my DigitalOcean referral link. It’s an affiliate link, so eligible signups can earn me account credit. Check the signup page for the current offer.

Recent doctl installations support browser authentication:

doctl auth login --context tutorial

Your browser opens DigitalOcean’s authorization page, where you choose the account or team and approve the permissions. doctl saves the credentials locally and refreshes the short-lived access token when needed. The authentication reference covers scope selection and browser options.

Alternatively, create a personal access token in DigitalOcean’s Applications & API settings, then enter it at the prompt:

doctl auth init --context tutorial

A read-only token is enough for an inventory script. Creating a Droplet needs more, and a scoped token may also need permission to look up associated resources.

Check that authentication worked:

doctl account get

This reads your account details without creating anything.

Switch between accounts and teams

An authentication context is a named set of credentials, for example one for personal work and one for a client. List them and choose the active one:

doctl auth list
doctl auth switch --context tutorial

You can also choose the context for one command:

doctl compute droplet list --context tutorial

I would make the context explicit in scripts that change infrastructure, so it’s harder to run a command against the wrong account.

You can remove the locally saved credentials for a context:

doctl auth remove --context tutorial

That leaves the cloud resources created with it in place. Revoke a personal access token through DigitalOcean’s token settings when you no longer need it.

Authenticate in automation

For a CI job, put a personal access token in the CI platform’s secret store and expose it as DIGITALOCEAN_ACCESS_TOKEN for that job.

doctl reads this environment variable, so the job can run commands without an interactive login:

doctl compute droplet list --output json

Don’t paste a token into a checked-in script, and avoid putting its literal value in --access-token, where it can end up in shell history or process arguments.

The local doctl configuration contains credentials too. Keep it out of Git and out of support tickets.

Learn the command structure

Most commands follow this pattern:

doctl service resource operation [arguments] [flags]

For example:

doctl compute droplet list

compute is the service group, droplet is the resource, and list is the operation.

Some groups are shallower. Listing managed databases is:

doctl databases list

You can ask for help at any level:

doctl --help
doctl compute --help
doctl compute droplet --help
doctl compute droplet create --help

The last one shows the required arguments, flags, and examples for creating a server. It also tells you when an online tutorial uses commands your installed version doesn’t have.

For tab completion in your current Bash session:

source <(doctl completion bash)

For Zsh, initialize its completion system and load doctl’s definitions:

autoload -Uz compinit
compinit
source <(doctl completion zsh)

To make completion permanent, follow your shell’s completion-directory setup. doctl can also generate Fish and PowerShell completion scripts.

Read output and extract values

The default output is a table. It’s convenient for reading, but scripts shouldn’t split it by spaces.

Choose only the columns you need:

doctl compute droplet list --format ID,Name,PublicIPv4,Status

Remove column headings when you want a raw value:

doctl compute droplet get 386734086 --format PublicIPv4 --no-header

386734086 is an example Droplet ID, so use one from your account whenever an example shows an ID. Many resources use UUIDs instead of numeric IDs.

For structured output, use JSON:

doctl compute droplet list --output json

With jq, you can turn that response into a small inventory:

doctl compute droplet list --output json |
  jq '.[] | {id, name, region: .region.slug, status}'

JSON field names can differ from table column names. PublicIPv4 is a table formatter name, while the JSON response puts network interfaces under networks.

To find each public IPv4 address:

doctl compute droplet list --output json |
  jq -r '.[] | .name as $name | .networks.v4[] |
    select(.type == "public") | [$name, .ip_address] | @tsv'

Not every command returns an array or supports --format, so look at its JSON and help before building a script around it.

Choose a region, image, and server size

We’ll create a small Ubuntu server running Nginx. DigitalOcean uses short identifiers called slugs for regions, images, and plans.

List the regions:

doctl compute region list

List operating system images:

doctl compute image list-distribution

List Droplet sizes:

doctl compute size list

Check a size’s current price and regional availability before choosing it. We’ll use nyc3, ubuntu-24-04-x64, and s-1vcpu-1gb in the examples. Pick alternatives from the lists if these aren’t available for your account.

Upload an SSH public key

Your private key stays on your computer, and DigitalOcean installs the public key on the new server. If you need help creating a key pair, see the free SSH course.

List the keys already in your account:

doctl compute ssh-key list

If the public key you want isn’t there, upload it:

doctl compute ssh-key import tutorial-laptop \
  --public-key-file "$HOME/.ssh/id_ed25519.pub"

Copy its ID from the output, and set a shell variable to it for this walkthrough:

SSH_KEY_ID=12345678

A key in your DigitalOcean account is available for new Droplets. Existing servers don’t get it automatically.

Organize the tutorial resources

A project groups resources in the dashboard, so you can find everything related to one application or environment.

Create one for this walkthrough and capture its ID:

PROJECT_ID=$(doctl projects create \
  --name doctl-tutorial \
  --purpose 'Web Application' \
  --environment Development \
  --format ID \
  --no-header)

You can list projects at any time:

doctl projects list

Also create a tag for our server:

doctl compute tag create doctl-tutorial

Tags are useful when a firewall or monitoring rule should follow a group of Droplets. Neither projects nor tags have anything to do with account permissions or network security.

Prepare the web server’s first boot

You can pass a script or a cloud-init configuration to a Droplet. cloud-init handles initialization when the machine first boots.

Save this as cloud-init.yaml in your working directory:

#cloud-config
package_update: true
packages:
  - nginx
write_files:
  - path: /var/www/html/index.html
    permissions: '0644'
    content: |
      <!doctype html>
      <html lang="en">
        <meta charset="utf-8">
        <title>doctl tutorial</title>
        <h1>Hello from DigitalOcean</h1>
      </html>
runcmd:
  - [systemctl, enable, --now, nginx]

This updates the package index, installs Nginx, and writes a small page. The file contains no credentials, so you can keep it in Git.

Keep long-lived secrets out of user data. Administrators and platform tooling may be able to read it.

Create the firewall before the server

We’ll allow HTTP connections from anywhere and SSH connections only from your public IPv4 address.

Find your current public IPv4 through your network settings or a trusted IP-check service. Set it here with /32, which means one IPv4 address:

ADMIN_CIDR=203.0.113.10/32

That address is reserved for documentation. Replace it with your real public IPv4, or the firewall will block your SSH connection.

Now create a firewall attached to the doctl-tutorial tag:

FIREWALL_ID=$(doctl compute firewall create \
  --name doctl-tutorial-web \
  --tag-names doctl-tutorial \
  --inbound-rules "protocol:tcp,ports:22,address:$ADMIN_CIDR protocol:tcp,ports:80,address:0.0.0.0/0" \
  --outbound-rules 'protocol:tcp,ports:all,address:0.0.0.0/0 protocol:udp,ports:all,address:0.0.0.0/0 protocol:icmp,address:0.0.0.0/0' \
  --format ID \
  --no-header)

Notice the rule syntax. Commas separate fields within a rule, and spaces separate complete rules, so the whole rule list needs quotes.

The outgoing rules allow package downloads, DNS lookups, and other IPv4 traffic. IPv6 stays disabled here; if you enable it later, add IPv6 rules too.

The firewall applies to every Droplet with the tag, so creating it first means the new server is never exposed without it.

Check the firewall:

doctl compute firewall get "$FIREWALL_ID"

You still need to secure SSH and keep the operating system updated. My Linux server security course covers that work.

Create the Droplet

We can now create the server with our SSH key, project, tag, and first-boot configuration:

DROPLET_ID=$(doctl compute droplet create doctl-web \
  --region nyc3 \
  --image ubuntu-24-04-x64 \
  --size s-1vcpu-1gb \
  --ssh-keys "$SSH_KEY_ID" \
  --project-id "$PROJECT_ID" \
  --tag-name doctl-tutorial \
  --user-data-file cloud-init.yaml \
  --enable-monitoring \
  --wait \
  --format ID \
  --no-header)

--wait waits for DigitalOcean’s provisioning operation. Nginx may still be installing while cloud-init runs.

Inspect the server:

doctl compute droplet get "$DROPLET_ID"

Extract its public address:

DROPLET_IP=$(doctl compute droplet get "$DROPLET_ID" \
  --format PublicIPv4 \
  --no-header)

Then connect over SSH:

doctl compute ssh "$DROPLET_ID" \
  --ssh-user root \
  --ssh-key-path "$HOME/.ssh/id_ed25519"

Check the host key fingerprint through a trusted channel before accepting a new SSH host key. doctl’s API credentials play no part in SSH authentication.

Inside the server, wait for initialization:

cloud-init status --wait
systemctl status nginx

Leave the SSH session:

exit

From your computer, request the page:

curl --fail "http://$DROPLET_IP"

You should see the HTML from cloud-init.yaml. This endpoint uses plain HTTP, so add TLS before using it for passwords, sessions, or other sensitive data.

Run a remote command

You don’t need an interactive SSH session every time. For example, check Nginx’s status with:

doctl compute ssh "$DROPLET_ID" \
  --ssh-key-path "$HOME/.ssh/id_ed25519" \
  --ssh-command 'systemctl is-active nginx'

This still runs over SSH, so your computer must reach the server’s SSH port, and the private key must match an authorized public key.

Understand asynchronous operations

Resizing a server or creating a snapshot starts work on DigitalOcean’s side that takes time. Some commands support --wait, and you can also inspect actions directly:

doctl compute droplet actions "$DROPLET_ID"
doctl compute action list

For an action ID returned by one of those commands:

doctl compute action get 987654321
doctl compute action wait 987654321 --wait-timeout 10m

A timeout only stops the CLI from waiting, and the operation can continue on DigitalOcean. Check the resource and action status before repeating a command that creates something.

A cloud operation can outlive the CLIdoctl submits an operation and DigitalOcean keeps working. A local timeout requires checking the existing operation before retrying.YesTimeoutYesNoSubmit createrequestDigitalOcean startsoperationCLI receivescompletion?Check applicationreadinessInspect resource andactionResource exists?Continue waiting orinvestigateDecide whether toretry

Restart, stop, and resize a server

To request a reboot:

doctl compute droplet-action reboot "$DROPLET_ID" --wait

To request a graceful shutdown:

doctl compute droplet-action shutdown "$DROPLET_ID" --wait

Check the Droplet’s status afterward, because a shutdown request can complete without the guest shutting down.

power-off forces it, but it can interrupt writes.

A powered-off Droplet is still billed. DigitalOcean keeps its resources reserved. Delete the Droplet when you want to stop paying for the server itself.

To resize, shut it down and confirm that its status is off. Then select an available size:

doctl compute droplet-action resize "$DROPLET_ID" \
  --size s-2vcpu-2gb \
  --wait

Power it back on:

doctl compute droplet-action power-on "$DROPLET_ID" --wait

The default resize changes CPU and memory and keeps the disk size. --resize-disk also grows the disk to the plan’s size, and since you can’t shrink a Droplet’s disk, you can’t go back to a smaller plan after that.

The Droplet action reference covers rebuilds, recovery, backup settings, and other operations. A rebuild replaces the server’s disk contents.

Snapshots, backups, and custom images

A snapshot is a disk image you can use to create another server or go back to a previous state. For a clean filesystem snapshot, shut down the server first. Databases may also need their own backup procedure for an application-consistent recovery point.

Create a snapshot:

doctl compute droplet-action snapshot "$DROPLET_ID" \
  --snapshot-name doctl-web-before-upgrade \
  --wait

List Droplet snapshots:

doctl compute snapshot list --resource droplet

If you shut down the tutorial server for the snapshot, start it again before continuing:

doctl compute droplet-action power-on "$DROPLET_ID" --wait

Snapshots have their own storage charges, and they stay around after you delete the original Droplet.

You can pass a snapshot image ID to --image when creating a new Droplet. Check which regions the image is available in first.

For automatic backups, look at the supported policies and backup options:

doctl compute droplet-action enable-backups --help
doctl compute droplet backup-policies --help

The image commands also cover account images and custom image imports:

doctl compute image list
doctl compute image create --help
doctl compute image-action transfer --help

Marketplace applications and autoscaling pools

Instead of a plain operating system image, you can start from a preconfigured Marketplace application:

doctl 1-click list --type droplet
doctl compute image list-application

Use the image slug or ID when creating a Droplet, then read the application’s setup instructions, since many images still need initial configuration and credentials.

Kubernetes Marketplace applications are listed separately:

doctl 1-click list --type kubernetes

The Kubernetes cluster commands can install supported 1-Click applications as part of cluster setup.

For applications that need more servers as traffic grows, doctl also manages Droplet autoscale pools:

doctl compute droplet-autoscale list
doctl compute droplet-autoscale create --help

A pool defines the machine image and size, instance limits, and scaling targets. Your application must work when instances appear and disappear, so keep user uploads and durable state off the server disks, and plan health checks and traffic routing before you enable it.

Private networks with VPCs

A VPC is a private network for cloud resources. Your application can use it to reach a database without sending that connection over the public internet.

List your VPCs:

doctl vpcs list

To create a separate network for a new environment:

doctl vpcs create \
  --name tutorial-private \
  --region nyc3 \
  --ip-range 10.50.0.0/24

Choose an address range that doesn’t overlap your existing networks. Use the returned UUID with --vpc-uuid when creating a new Droplet. Keep database access rules and host security in place inside the VPC too.

doctl also has commands for VPC peerings, NAT gateways, and specialized connectivity:

TaskWhere to look
Inspect a VPCdoctl vpcs get --help
Connect VPC networksdoctl vpcs peerings --help
Manage outbound NATdoctl compute vpc-nat-gateway --help
Manage partner network attachmentsdoctl network attachment --help
Manage bring-your-own-IP prefixesdoctl network byoip-prefix --help

These features have regional and account requirements, so check their availability before designing a network around them.

Reserved IP addresses

A reserved IP is an address you can reassign to another compatible Droplet in the same region.

Allocate one and assign it to a Droplet:

doctl compute reserved-ip create --droplet-id "$DROPLET_ID"

List reserved addresses:

doctl compute reserved-ip list

To move an existing address, use its IP and the replacement Droplet ID:

doctl compute reserved-ip-action assign 203.0.113.25 386734112

This only changes where traffic goes. Your application and data have to be on the replacement server already. Check the current reserved-IP billing rules too, especially for unassigned addresses.

IPv6 reservations have their own commands under compute reserved-ipv6.

DNS records

doctl manages domains hosted in DigitalOcean DNS. You register the domain with a registrar, and delegate its nameservers to DigitalOcean if you want these records to be authoritative.

List hosted domains:

doctl compute domain list

The examples use tutorial.flaviocopes.com. Replace it with a domain you control.

Create a DNS zone:

doctl compute domain create tutorial.flaviocopes.com

Create an A record named web:

doctl compute domain records create tutorial.flaviocopes.com \
  --record-type A \
  --record-name web \
  --record-data "$DROPLET_IP" \
  --record-ttl 300

That produces web.tutorial.flaviocopes.com. List its records:

doctl compute domain records list tutorial.flaviocopes.com

You can also manage AAAA, CNAME, MX, TXT, CAA, and other record types. Read the record-specific flags before adding mail or certificate-validation records.

If you’re new to records and delegation, the DNS course explains how they fit together.

Certificates and load balancers

A load balancer accepts incoming traffic and forwards it to healthy servers. It can also terminate HTTPS.

For a domain managed in DigitalOcean DNS, request a managed Let’s Encrypt certificate:

doctl compute certificate create \
  --name tutorial-web-tls \
  --type lets_encrypt \
  --dns-names web.tutorial.flaviocopes.com

The compute certificate group can also import custom certificates. List the available certificates with:

doctl compute certificate list

As a separate HTTP-only example, create a regional load balancer pointing at our tagged server:

doctl compute load-balancer create \
  --name tutorial-web-lb \
  --region nyc3 \
  --size lb-small \
  --tag-name doctl-tutorial \
  --forwarding-rules 'entry_protocol:http,entry_port:80,target_protocol:http,target_port:80' \
  --health-check 'protocol:http,port:80,path:/,check_interval_seconds:10,response_timeout_seconds:5,healthy_threshold:3,unhealthy_threshold:3' \
  --wait

This is another billable resource. Our tutorial firewall already allows HTTP to the backend, so the health check reaches Nginx once the server is powered on.

For a production service, configure HTTPS forwarding with the certificate ID. You can also restrict backend HTTP access to the load balancer with a firewall rule’s load_balancer_uid source, but keep your working access path until the new rules are in place.

The load-balancer reference covers forwarding rules, sticky sessions, internal load balancers, and global load balancers. The flags differ between load-balancer types.

Block storage volumes

A volume is a separate block device you attach to a Droplet, for persistent storage beyond the server’s root disk.

Create a small formatted volume in the same region as the Droplet:

VOLUME_ID=$(doctl compute volume create tutorial-data \
  --region nyc3 \
  --size 10GiB \
  --fs-type ext4 \
  --format ID \
  --no-header)

Attach it:

doctl compute volume-action attach "$VOLUME_ID" "$DROPLET_ID" --wait

Attaching the device and mounting a filesystem are separate steps, although DigitalOcean can automatically mount preformatted volumes on supported images such as the Ubuntu one used here.

On the Droplet, check the disks and mounts with:

lsblk -f
findmnt

Use the stable device identifier from /dev/disk/by-id/ or the filesystem UUID for persistent mounts. Be careful with an existing volume that isn’t mounted: formatting it destroys its filesystem.

doctl also supports volume resizing, snapshots, and detachment:

doctl compute volume list
doctl compute volume-action resize --help
doctl compute volume snapshot --help
doctl compute volume-action detach --help

After growing a volume you may need to grow its filesystem inside Linux. Unmount it before detaching it.

Network File Storage

Network File Storage, or NFS, provides a shared filesystem that several machines can mount, unlike a block device attached to one Droplet.

doctl can create shares, attach them to VPCs, resize them, manage snapshots, and configure access points.

For example, list the shares in a region where NFS is available:

doctl nfs list --region atl1

Look at the creation and access-point options:

doctl nfs create --help
doctl nfs access-point --help

Creating a share requires its name, region, size, performance tier, and allowed VPC IDs. The NFS documentation lists supported values and the client mount instructions. Clients still need network access and an NFS mount.

Spaces object storage and CDN

Spaces stores objects such as images, downloads, and backups, behind an S3-compatible API.

doctl manages Spaces access keys, but does not upload or download objects. Use an S3 client such as AWS CLI, rclone, or s3cmd for the files. DigitalOcean documents this in doctl’s limits.

The key-management commands:

doctl spaces keys list
doctl spaces keys create --help

Spaces access keys are separate from your DigitalOcean API token. Scope them to the buckets and operations the application needs.

With AWS CLI configured with a dedicated Spaces profile, a file upload looks like this:

aws --profile spaces \
  --endpoint-url https://nyc3.digitaloceanspaces.com \
  s3 cp ./report.pdf s3://tutorial-assets/reports/report.pdf

Here tutorial-assets is an existing bucket you own, and report.pdf a local file. Substitute your bucket, file, and region endpoint.

doctl also manages the CDN. List existing CDN endpoints:

doctl compute cdn list

For a public Spaces origin you own, create an endpoint:

doctl compute cdn create https://tutorial-assets.nyc3.digitaloceanspaces.com

After replacing an object at the same path, you may need to invalidate its cached copy, which is a separate request from the upload:

doctl compute cdn flush --help

Managed PostgreSQL and other databases

With a managed database, DigitalOcean does most of the administration and you choose the engine, capacity, and access rules. We’ll use PostgreSQL. First, look at the available engines, regions, versions, and sizes:

doctl databases options engines
doctl databases options regions --engine pg
doctl databases options versions --engine pg
doctl databases options slugs --engine pg

Create a single-node tutorial cluster:

doctl databases create tutorial-postgres \
  --engine pg \
  --region nyc3 \
  --size db-s-1vcpu-1gb \
  --num-nodes 1 \
  --wait

Choose an available plan from the options output. A single node keeps the setup small, with no standby nodes for redundancy.

List clusters and copy this one’s ID:

doctl databases list

Set it in your shell, replacing the example UUID:

DB_ID=0b5b8b35-756c-4e13-9b14-51a4050dbb5a

Restrict database connections

Set trusted sources before putting application data in the cluster. For our tagged web server:

doctl databases firewalls append "$DB_ID" --rule tag:doctl-tutorial

Inspect the complete rule set:

doctl databases firewalls list "$DB_ID"

append keeps existing rules, so look for broad access you didn’t mean to keep. replace replaces the whole set, so read its help before using it.

A trusted-source rule only allows a client. The client still needs a network route to the database endpoint.

Create databases, users, and connection pools

The managed cluster is the service, and it contains individual databases and users.

Create an application database and user:

doctl databases db create "$DB_ID" tutorial
doctl databases user create "$DB_ID" tutorial_app

Review the user’s permissions for your application, and keep the administrator account out of routine application queries.

Inspect connection details:

doctl databases connection "$DB_ID"

For a client in the private network:

doctl databases connection "$DB_ID" --private

Connection output can contain credentials. Current doctl releases mask sensitive values in many interactive outputs, but reveal them in some scripting contexts, so keep connection output and JSON out of CI logs.

The cluster’s CA certificate is available through get-ca. Check its output options:

doctl databases get-ca --help

Configure your PostgreSQL client to verify TLS with that CA, on the private network too.

A PostgreSQL connection pool lets many application requests share a smaller number of database connections:

doctl databases pool create "$DB_ID" tutorial-pool \
  --db tutorial \
  --user tutorial_app \
  --mode transaction \
  --size 10

Transaction pooling limits what session state your application can rely on. Check your database library’s pooling guidance before using it.

Backups, replicas, maintenance, and engine-specific features

Inspect the backups and maintenance settings:

doctl databases backups "$DB_ID"
doctl databases maintenance-window get "$DB_ID"

The database commands also cover these tasks:

TaskCommand area
Create a read replicadatabases replica create
Resize capacitydatabases resize
Fork a clusterdatabases fork
Change database configurationdatabases configuration
Change maintenance timingdatabases maintenance-window update
Inspect database eventsdatabases events list
Manage Kafka topicsdatabases topics
Manage search indexesdatabases indexes
Inspect supported migration operationsdatabases migrate --help

The available features depend on the engine: connection pools are PostgreSQL, topics are Kafka, and indexes are OpenSearch.

My advice is to test a restore before you need one.

Deploy with App Platform

App Platform builds and runs an application from source code or a container image.

doctl manages an app through an app spec, a YAML or JSON document describing its components.

For an existing app, list it and export its spec:

doctl apps list
doctl apps spec get f3a1c9e2-7b4d-4e8a-9c21-5d6b0e4f8a17 > app.yaml

Use your app’s ID from doctl apps list. Review exported configuration before committing it, especially environment settings and references to private services.

Create an app from a spec

We’ll use a small Node.js HTTP service here and reuse it in the container examples. Create a repository named tutorial-api in your own GitHub account.

Save this as package.json:

{
  "name": "tutorial-api",
  "private": true,
  "type": "module",
  "scripts": {
    "start": "node server.js"
  }
}

Save the server as server.js:

import { createServer } from 'node:http'

const port = Number(process.env.PORT || 8080)

createServer((request, response) => {
  response.writeHead(200, { 'content-type': 'application/json' })
  response.end(JSON.stringify({ message: 'Hello from DigitalOcean' }))
}).listen(port, '0.0.0.0')

Generate a lockfile and test it locally:

npm install --package-lock-only
npm start

Open http://localhost:8080/ to check the response. Commit package.json, package-lock.json, and server.js to your repository’s main branch, then push them to GitHub.

An app.yaml for this service looks like this:

name: tutorial-api
region: nyc
services:
  - name: web
    github:
      repo: YOUR_GITHUB_USERNAME/tutorial-api
      branch: main
      deploy_on_push: true
    build_command: npm ci
    run_command: npm start
    http_port: 8080
    instance_count: 1
    instance_size_slug: basic-xxs
    health_check:
      http_path: /
    envs:
      - key: NODE_ENV
        value: production
        scope: RUN_TIME
ingress:
  rules:
    - match:
        path:
          prefix: /
      component:
        name: web

Replace the repository with one you control. It needs a lockfile for npm ci, a start script, and a service listening on 0.0.0.0:8080, and the / endpoint must respond successfully for the health check.

Your DigitalOcean account also needs access to the GitHub repository, through DigitalOcean’s GitHub integration. A doctl token alone isn’t enough.

App Platform has its own region and instance-size identifiers. Notice nyc here, compared with nyc3 for our Droplet. Check the app-specific options:

doctl apps list-regions
doctl apps tier instance-size list

Validate your spec:

doctl apps spec validate app.yaml

Then create the app:

doctl apps create --spec app.yaml --wait

Validation only checks the spec. Dependencies, repository access, and runtime behavior can still make the build fail.

Update, deploy, and investigate an app

Save your app ID in a variable:

APP_ID=f3a1c9e2-7b4d-4e8a-9c21-5d6b0e4f8a17

After editing the spec, apply it:

doctl apps update "$APP_ID" --spec app.yaml --wait

By default, this updates configuration without fetching new source code. Add --update-sources to fetch current source changes too.

To create a deployment using the app’s current configuration:

doctl apps create-deployment "$APP_ID" --wait

Inspect deployment history and build logs:

doctl apps list-deployments "$APP_ID"
doctl apps logs "$APP_ID" web --type build

Follow runtime logs:

doctl apps logs "$APP_ID" web --type run --follow

A console session lets you look inside the running component:

doctl apps console "$APP_ID" web

Changes you make inside a running container are lost on the next deployment, so put them in the repository and redeploy.

Static sites, workers, and jobs have their own spec settings. doctl also exposes alerts, instances, job invocation history, and local component builds under apps dev.

For more background on the service itself, see my App Platform introduction.

Container registries

A container registry stores images that Docker, Kubernetes, and deployment platforms can pull.

Current doctl has both registry and registries command groups. The plural group works with named registries, so we’ll use it here. Older examples often use the singular form.

List your registries and the available plans:

doctl registries list
doctl registries options subscription-tiers
doctl registries options available-regions

Choose a globally unique registry name and a plan. For example, after replacing this name with your own:

doctl registries create YOUR_UNIQUE_REGISTRY_NAME \
  --region nyc3 \
  --subscription-tier basic

Set the name for the following commands:

REGISTRY_NAME=YOUR_UNIQUE_REGISTRY_NAME

Log Docker into it with credentials that expire after an hour:

doctl registries login "$REGISTRY_NAME" --expiry-seconds 3600

For the Node.js service from the App Platform section, save this as Dockerfile beside server.js:

FROM node:lts-alpine
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
COPY server.js ./
USER node
EXPOSE 8080
CMD ["node", "server.js"]

This example uses the moving LTS tag to keep things small. For production, pick a supported Node.js release and plan updates to your base image.

Build and push the image:

docker build -t "registry.digitalocean.com/$REGISTRY_NAME/tutorial-api:demo" .
docker push "registry.digitalocean.com/$REGISTRY_NAME/tutorial-api:demo"

Build for the architecture of your deployment target. An ARM image built on a Mac won’t run on an x86-only target unless you build a matching or multi-architecture image.

List the repositories and image tags:

doctl registries repository list-v2 "$REGISTRY_NAME"
doctl registries repository list-tags "$REGISTRY_NAME" tutorial-api

For a machine that only pulls images, use --read-only when obtaining registry credentials. Generated Kubernetes Secret manifests and Docker authentication configuration contain credentials, so treat their output as a secret.

Deleting a tag may leave image storage behind. Look at the manifest and garbage-collection commands when cleaning a registry.

If containers are new to you, the Docker course explains images, builds, and registries.

Kubernetes clusters

DigitalOcean Kubernetes runs a managed Kubernetes control plane with worker nodes in your account.

First look at the supported regions, versions, and node sizes:

doctl kubernetes options regions
doctl kubernetes options versions
doctl kubernetes options sizes

Create a small cluster only if you want to follow this section, because worker nodes and the resources Kubernetes creates add to your bill:

doctl kubernetes cluster create tutorial-cluster \
  --region nyc3 \
  --size s-2vcpu-2gb \
  --count 2 \
  --wait

Choose a supported node size. Without --version, the service picks its default version.

Connect kubectl

Install kubectl separately, then save the cluster configuration:

doctl kubernetes cluster kubeconfig save tutorial-cluster

Check which Kubernetes context is active before changing workloads:

kubectl config current-context
kubectl get nodes

doctl manages the DigitalOcean cluster. kubectl manages Deployments, Services, Pods, and other Kubernetes objects inside it.

Be careful if the same computer also manages production clusters, because saving kubeconfig can change the current context.

Deploy the container image

If you followed the registry section, generate a registry pull Secret for the default namespace and apply it:

doctl registries kubernetes-manifest "$REGISTRY_NAME" \
  --namespace default |
  kubectl apply -f -

The Secret is named registry- followed by your registry’s name. Workloads reference it through imagePullSecrets, and existing Pods don’t pick it up on their own.

For example, generate a Deployment manifest from the image, add the pull Secret, and apply it:

kubectl create deployment tutorial-api \
  --image="registry.digitalocean.com/$REGISTRY_NAME/tutorial-api:demo" \
  --dry-run=client \
  -o json |
  jq --arg secret "registry-$REGISTRY_NAME" \
    '.spec.template.spec.imagePullSecrets = [{name: $secret}]' |
  kubectl apply -f -

Watch the rollout:

kubectl rollout status deployment/tutorial-api
kubectl get pods

For an application listening on port 8080, test it locally through a port forward:

kubectl port-forward deployment/tutorial-api 8080:8080

In another terminal, request it:

curl --fail http://localhost:8080/

A port forward saves you from creating a public load balancer just to test this. For production exposure you need a Service or ingress setup with TLS.

Node pools, autoscaling, and upgrades

Inspect node pools:

doctl kubernetes cluster node-pool list tutorial-cluster

Node-pool creation supports settings such as --auto-scale, minimum and maximum node counts, labels, and taints, so a cluster can have different pools for different workloads.

Check upgrades available to the cluster:

doctl kubernetes cluster get-upgrades tutorial-cluster

Read the upgrade options before changing it:

doctl kubernetes cluster upgrade --help

Cluster upgrades and node replacement affect workloads, so applications that need to stay up need readiness checks, more than one replica, and disruption budgets.

Deleting a cluster needs care too. LoadBalancer Services and persistent volumes can create resources that outlive the cluster, so read the deletion flags and look for leftovers afterward.

Serverless Functions

DigitalOcean Functions runs functions without a server for you to manage. The serverless commands use an extension, so install it first:

doctl serverless install
doctl serverless status

List existing namespaces:

doctl serverless namespaces list

A namespace is the environment your functions deploy into. You can connect to an existing one, or create a tutorial namespace in a supported Functions region:

doctl serverless namespaces create --label doctl-tutorial --region nyc1

The create command connects your local serverless tooling to the new namespace by default.

Initialize a JavaScript project:

doctl serverless init tutorial-functions --language javascript

The generated project includes a project configuration and sample function code, organized into packages and functions.

Deploy it:

doctl serverless deploy tutorial-functions

List functions to see their exact package and function names:

doctl serverless functions list

If the generated sample is listed as sample/hello, invoke it with:

doctl serverless functions invoke sample/hello --param name:Flavio

Use the name from your output if the template differs. Add --full to include the activation record, which contains execution information and logs.

The activation commands:

doctl serverless activations --help

During development, serverless watch deploys changes as you edit. Check the connected namespace before starting it, because edits trigger real remote deployments.

Don’t confuse it with AI inference: sending a prompt to a hosted model uses serverless-inference.

Secrets Manager

Secrets Manager stores named collections of key-value pairs. Suppose your app needs a database password. Put the value in a local file named database-password.txt that is excluded from Git and readable only by your user.

Create a secret from that file:

doctl secrets create tutorial-api \
  --region nyc3 \
  --value database-password=@./database-password.txt

The @ tells doctl to read the value from the file, so the password stays out of the command line. Make sure the file contains exactly the value, because a trailing newline can become part of the secret.

List secrets and inspect versions:

doctl secrets list
doctl secrets list-versions tutorial-api --region nyc3

To retrieve one value for a process that needs it, secrets get supports --key and --raw:

doctl secrets get tutorial-api \
  --region nyc3 \
  --key database-password \
  --raw

That command prints the secret, so avoid it in shared terminals or logged CI steps, and pipe it straight into the consumer when automating.

The broader command set includes set, unset, update, delete, and restore. Their help explains which ones change individual keys and which replace a secret’s contents.

Your Droplets and apps don’t receive stored values automatically. Each workload needs a supported retrieval path and the right permissions.

Monitoring and uptime checks

doctl can create resource alert policies and external uptime checks.

For our tagged Droplet, this memory alert emails you if utilization stays above 80% for five minutes:

doctl monitoring alert create \
  --description 'Tutorial server memory above 80 percent' \
  --type v1/insights/droplet/memory_utilization_percent \
  --compare GreaterThan \
  --value 80 \
  --window 5m \
  --tags doctl-tutorial \
  --emails [email protected]

Put your own address in --emails. Metrics like memory depend on the monitoring agent, which we installed with --enable-monitoring when creating the Droplet.

List your alert policies:

doctl monitoring alert list

An uptime check tests a service from outside the server. Its creation options:

doctl monitoring uptime create --help

You can configure checks for endpoints and add alerts for availability, latency, or certificate expiry. The check and its alert are created separately.

Security posture scans

The security group manages cloud security posture management scans, also called CSPM scans:

doctl security scans --help

These commands create and inspect scans and show the resources associated with findings. Application security testing, dependency review, and patching are still separate work.

AI model requests from the terminal

Recent doctl releases can make inference requests directly. The command group is serverless-inference, also available as inference.

This service has its own authentication requirements. The inference command reference says it accepts a model access key or a full-access DigitalOcean personal access token, so a narrowly scoped token that works for Droplets may fail here.

List the models exposed by the inference API:

doctl serverless-inference models list

Pick a supported chat model from that output and set its ID:

CHAT_MODEL=YOUR_CHAT_MODEL_ID

Send a prompt:

doctl serverless-inference chat-completions create \
  --model "$CHAT_MODEL" \
  --message 'Explain what a DigitalOcean VPC does in two sentences.' \
  --max-tokens 200

Add --stream to receive the response as it arrives. Inference requests can incur usage charges, even though nothing shows up in your Droplet list.

Send a complete JSON request

For more control, put the request body in chat-request.json, with a model ID from your account:

{
  "model": "YOUR_CHAT_MODEL_ID",
  "messages": [
    {
      "role": "system",
      "content": "Explain Linux commands to a beginner."
    },
    {
      "role": "user",
      "content": "What does df -h show?"
    }
  ],
  "max_tokens": 200
}

Send that file:

doctl serverless-inference chat-completions create \
  --request chat-request.json

Embeddings, images, and other inference APIs

An embedding turns text into a vector of numbers that applications use for similarity search.

Choose a supported embedding model, then send text:

EMBEDDING_MODEL=YOUR_EMBEDDING_MODEL_ID
doctl serverless-inference embeddings create \
  --model "$EMBEDDING_MODEL" \
  --input 'A guide to deploying a Node.js application'

The inference commands also expose image generation, Responses-style requests, Anthropic-style messages, and asynchronous invocations:

doctl serverless-inference images create --help
doctl serverless-inference responses create --help
doctl serverless-inference messages create --help
doctl serverless-inference async-invoke create --help

Each endpoint needs a model and request format it supports. A chat model won’t generate images, and the API styles accept different fields.

Dedicated inference endpoints

With a dedicated inference endpoint, you manage a deployed model-serving resource instead of sending requests to a shared inference service.

doctl can inspect, create, update, and delete those endpoints:

doctl dedicated-inference list
doctl dedicated-inference create --help

Creation takes a YAML or JSON spec with --spec. The dedicated inference reference explains how to select a model and supported infrastructure.

Gated models may need a Hugging Face credential. Keep it out of checked-in specs and shell history.

A dedicated endpoint has a different capacity and billing model from a single chat request, so check its running state and delete it when you no longer need it.

Vector databases, knowledge bases, evaluations, and Signals

doctl also manages DigitalOcean’s retrieval and evaluation services. vector-databases creates and resizes vector databases and handles their credentials, backups, and restores. knowledge-base connects data sources, runs indexing jobs, and attaches knowledge bases to agents. evaluation manages datasets, metrics, model evaluation runs, and agent simulations, and signals manages consent, interaction sessions, data exports, and deletion jobs. Each group’s --help lists its subcommands and required flags.

To create a vector database, after checking the available plans and regions:

doctl vector-databases create tutorial-search \
  --region nyc3 \
  --size small \
  --wait

Provisioning the database doesn’t populate it with your documents. Use the database’s client API to create the collections or indexes your application needs and ingest vectors. The credentials it returns are sensitive.

Older tutorials may show doctl gradient. DigitalOcean has deprecated that command family. Use knowledge-base and serverless-inference for the corresponding current operations. The old Gradient agent-management commands have no direct CLI replacement, so use the documented control panel or API for those agents.

Run hosted coding agents

DigitalOcean’s Managed Agents Runtime Services, or M.A.R.S, can run a coding agent in a hosted sandbox. Its doctl command group is harness-runtime.

DigitalOcean labels this service a public preview in the runtime documentation. Check its current availability and billing before using it.

The main commands:

CommandWhat it does
launchOpens a session, creating one first when given creation options
createCreates a session without opening its interactive chat
promptSends a prompt to an existing session
execRuns a command directly in the sandbox
pause / resumeChanges whether a session is running
removeRemoves the session

For example, to create a Claude Code session for a repository you control:

doctl harness-runtime create \
  --name tutorial-review \
  --harness claude-code \
  --gh-repo YOUR_GITHUB_USERNAME/tutorial-api \
  --permission ask \
  --prompt 'Inspect the project and explain how the HTTP server starts.'

Connect GitHub access and model-provider credentials first, since a DigitalOcean login gives the sandbox no access to private repositories or a model provider. The runtime’s help explains provider connections and secret input.

--permission ask requests approval for tool calls. The documented default is allow, so set it on purpose.

Inspect the session and open it:

doctl harness-runtime show tutorial-review
doctl harness-runtime launch tutorial-review

You can also run a command directly in its sandbox:

doctl harness-runtime exec tutorial-review -- git status --short

The -- separates the guest command’s arguments from doctl’s flags. With exec, you choose the command, not the coding agent.

Each exec call is independent, so a cd in one call doesn’t carry over to the next. Use --workdir when you need a specific directory.

The runtime also supports file upload and download, logs, reusable agent configurations, templates, triggers, and session lifecycle operations:

doctl harness-runtime list
doctl harness-runtime logs tutorial-review
doctl harness-runtime checkpoint --help
doctl harness-runtime fork --help
doctl harness-runtime triggers --help

Checkpoint and rollback coverage depends on the harness. The documented codex-agentapi mode keeps agent-loop state at OpenAI, which DigitalOcean sandbox checkpoints don’t cover.

When finished, remove the session:

doctl harness-runtime remove tutorial-review

A hosted session can modify files and talk to services with the credentials and permissions you give it, so review the repository changes before pushing them.

Projects, tags, and inventory

List just the tutorial’s Droplets:

doctl compute droplet list --tag-name doctl-tutorial

List resources assigned to the project:

doctl projects resources list "$PROJECT_ID"

To assign an existing Droplet, use its resource URN:

doctl projects resources assign "$PROJECT_ID" \
  --resource "do:droplet:$DROPLET_ID"

A URN identifies both the resource type and its ID, like do:droplet:386734086, while a Droplet ID is only the number.

Deleting or changing a project won’t clean up every service an application created, because a project doesn’t track dependencies.

For larger inventories, export individual resource families as JSON and combine them in a report. Leave connection details out unless you need them.

Billing, invoices, and limits

You can check account balance and billing history from the terminal:

doctl balance get
doctl billing-history list
doctl invoice list

The invoice retrieval options:

doctl invoice get --help

The prepayment commands show prepayment configuration and status, for services that use prepaid balances:

doctl prepayment config
doctl prepayment status

For API request limits:

doctl account ratelimit

The API rate limit is separate from your Droplet quota, account spending settings, and service-specific limits. If a create request fails, read which limit it hit.

Billing output covers what you’ve been charged so far. To estimate future costs, keep an inventory of persistent resources such as volumes, snapshots, databases, and load balancers.

Write a useful automation script

A good first script is a read-only report, because rerunning it never creates anything.

Save this as tutorial-inventory.sh:

#!/usr/bin/env bash
set -euo pipefail

context=${1:-tutorial}

doctl --context "$context" \
  compute droplet list \
  --tag-name doctl-tutorial \
  --output json |
  jq -r '.[] | [.id, .name, .status, .region.slug] | @tsv'

Run it with:

bash tutorial-inventory.sh tutorial

set -euo pipefail stops the script on failed commands, unset variables, and failures inside pipelines. A provisioning script needs more than that to be safe.

Make create scripts safe to rerun

If you put droplet create in a script and run it twice, you get two servers. Resource names aren’t unique across DigitalOcean services.

So before creating, look up the resource and decide what to do when zero, one, or several matches exist.

A sequential script can check for an existing tagged server:

doctl compute droplet list \
  --tag-name doctl-tutorial \
  --output json |
  jq '[.[] | select(.name == "doctl-web")] | length'

If it returns 1, inspect that server instead of creating another. If it returns more than 1, stop and sort it out.

Concurrent deployment jobs can still race between the lookup and the create. Serialize provisioning, or use a tool with state management.

Use exit status and timeouts

Check the exit status before using a captured ID. A nonzero result means the command failed locally, but after a timeout or a lost response the cloud operation may still exist.

For a known action, wait with a finite timeout and investigate afterward:

doctl compute action wait 987654321 --wait-timeout 10m

doctl retries some rate-limit and server errors, and --http-retry-max controls the retry count. More retries won’t help with an invalid token, a missing permission, or an unsupported size.

Be deliberate about destructive commands

Many deletion commands ask for confirmation and support --force for unattended use. --force only skips the prompt, so it’s on you to pass the right resource.

Resolve and print the exact resource IDs before the destructive step, and never pipe every ID in the account into a delete command.

Check how the current release masks output before logging JSON, because masking in the terminal doesn’t always carry over to automation.

doctl, Terraform, and configuration management

I would use doctl for a one-off operation, a small script, or a quick inspection during an incident.

For infrastructure that needs to be recreated and reviewed over time, Terraform can be a better fit. It records desired resources and compares them with stored state before applying changes.

ToolWhat I would use it for
doctlList servers, inspect failures, start a deployment, automate a small operation
TerraformReview and manage a persistent set of cloud resources
cloud-initSet up a machine’s first boot
AnsibleConfigure machines repeatedly as their desired setup changes
SSHInspect or administer the operating system
kubectlManage Kubernetes workloads
S3 clientUpload, download, and synchronize Spaces objects

They work together: Terraform creates a server, cloud-init initializes it, and doctl inspects it.

Avoid unrecorded doctl changes to resources Terraform owns, or a later Terraform run may undo them or report drift.

Troubleshoot common problems

A command doesn’t exist

Check the installed version and help:

doctl version
doctl --help

Update an old installation before assuming a feature is unavailable, especially for browser login, Secrets Manager, the newer AI commands, and hosted agent sessions. Commands also get renamed, like the deprecated Gradient family.

Authentication works, but an operation is forbidden

Confirm the context and account:

doctl auth list
doctl account get

Then check the credential’s permissions and the account’s role. A valid token can still lack access to a particular operation.

In CI, check whether DIGITALOCEAN_ACCESS_TOKEN is selecting different credentials from your local configuration. Check whether it’s set without printing its contents.

SSH times out

Check the public address, the firewall, the SSH port, and whether your public IP changed. The tutorial firewall only allows SSH from the address in ADMIN_CIDR.

If you use a private IP, your computer needs a network path into the VPC.

Permission denied (publickey) is an SSH problem, not an API one, so check the SSH user and private key.

The Droplet is active, but the website is unavailable

Check cloud-init and Nginx over SSH:

cloud-init status --long
systemctl status nginx
journalctl -u nginx --no-pager -n 50

Then check the cloud firewall, and whether the service listens on the expected interface and port. A process bound only to 127.0.0.1 won’t accept a public connection.

A region or size is rejected

Use the options for that service. Droplets, databases, App Platform, and Kubernetes each have their own list of sizes and regions.

Check image availability and account quotas as well, because a valid slug can still be unavailable for the combination you asked for.

A command timed out

Inspect the existing resource and operation before retrying. The server may already exist, or a resize may still be running.

You need more diagnostic detail

Start with verbose output:

doctl compute droplet list --verbose

--trace adds network details. Review traces before sharing them, because requests and responses can contain private account information.

Clean up the tutorial

These commands remove data, and the independent sections may have created resources outside the tutorial project. First inspect the server and project:

doctl compute droplet get "$DROPLET_ID"
doctl projects resources list "$PROJECT_ID"

When you’re ready, delete the tutorial Droplet:

doctl compute droplet delete "$DROPLET_ID"

Delete the firewall once no tutorial server needs it:

doctl compute firewall delete "$FIREWALL_ID"

If you followed the volume example, check that the volume is detached and no longer needed, then delete it:

doctl compute volume delete "$VOLUME_ID"

Use the matching group for each other resource:

Resource you createdCleanup command
App Platform appdoctl apps delete "$APP_ID"
Managed database clusterdoctl databases delete "$DB_ID"
Kubernetes clusterdoctl kubernetes cluster delete tutorial-cluster
NFS sharedoctl nfs delete --help
Hosted agent sessiondoctl harness-runtime remove tutorial-review
Functions namespacedoctl serverless namespaces delete --help
Container registrydoctl registries delete "$REGISTRY_NAME"
Reserved IPdoctl compute reserved-ip delete --help
Load balancerdoctl compute load-balancer delete --help
Snapshotdoctl compute snapshot delete --help
Monitoring policydoctl monitoring alert delete --help
Uptime checkdoctl monitoring uptime delete --help
CDN endpointdoctl compute cdn delete --help
Dedicated inference endpointdoctl dedicated-inference delete --help
Stored secretdoctl secrets delete --help

The help entries show which IDs or region flags each service needs. Use the IDs from your own inventory, and keep confirmation prompts on while learning.

Check separately for Spaces objects and buckets with your S3 client, retained Kubernetes volumes or load balancers, registry storage, DNS records, certificates, monitoring resources, and snapshots.

Once the tutorial resources are gone, remove the now-unused project and tag:

doctl projects delete "$PROJECT_ID"
doctl compute tag delete doctl-tutorial

If you created a separate VPC, check its members before deleting it. Revoke temporary API tokens and Spaces keys when you no longer need them.

How I would use doctl

I’d start with the read-only commands on an existing account. List servers, inspect their tags and projects, check deployment logs, and understand the current billable resources.

Then I’d keep a small set of scripts for operations I repeat, like finding a server’s address, checking an App Platform deployment, and exporting an infrastructure inventory.

For a temporary server, the Droplet walkthrough is enough to make creation repeatable. For a larger environment with several services, I’d put the infrastructure definition in Terraform and use doctl to inspect it and handle individual operations.

I wouldn’t grow a pile of shell commands into an improvised infrastructure manager. Once a script needs its own dependency graph, locking, rollback rules, and persistent resource state, I’d switch to a tool built for that.

Keep the doctl reference open as you work. Start with one service, read its --help, and practice the full lifecycle, including deletion, before automating it.

Want me to talk about your product? You can sponsor this site.

Related posts about cli: