doctl Verified current stable Not installed? Cloud Infrastructure

Doctl / List Database Clusters

List Database Clusters

Lists all database clusters associated with a DigitalOcean account.

$
Terminal
doctl d ls

When To Use

When inventorying existing database clusters for auditing or management purposes.

Pro Tip

Use the `--format` option for a tabulated view to easily parse through large lists.

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
ID          Name               Engine      Version   Size      Status
-------------------------------------------------------------
12345678    prod-db           postgres    13        db-s-1vcpu-1gb  active
87654321    staging-db        mysql       8.0       db-s-2vcpu-2gb  active
23456789    test-db           redis       6.0       db-s-1vcpu-1gb  offline

Anatomy of Output

Understanding the result

ID Name Status Header

Column titles for output.

<id> <dbname> <status> Database Info

Planting all clusters in an easily readable tabulated format.

Total: <count> clusters found. Summary

Provides an overview of the number of clusters listed.

Troubleshooting

Common pitfalls

Error: Unable to find any database clusters

Solution: Ensure that at least one database cluster is provisioned in your account.

Error: Invalid filter for database type

Solution: Check the input provided for filtering, and ensure it is supported.

Error: Permissions insufficient to list clusters

Solution: Confirm your API token has the correct permissions to access database resources.

Command Breakdown

What each part is doing

doctl
Base Command
The executable that performs this operation. Here it runs Doctl before the shell applies any redirect operators.
d
d|databases
The value supplied for d|databases.
ls
ls|list
The value supplied for ls|list.

How To Run

Execution path

  1. Step 1

    Open terminal and authenticate with `doctl auth init`.

  2. Step 2

    Run `doctl databases list` to view all database clusters.

Alternative Approaches

Comparable commands in other tools

Alternative cloud infrastructure tools for the same job.