doctl-databases
Manage DigitalOcean managed databases
TLDR
Run a doctl databases command with an access token
Get details for a database cluster
List your database clusters
Create a database cluster
Delete a cluster
SYNOPSIS
doctl databases [<subcommand>] [flags]
PARAMETERS
--access-token string
API access token (overrides config)
-h, --help
Help for databases
--output string
Output format [text|json|yaml] (default "text")
--trace
Trace mode; print all requests/responses
--verbose
Verbose output mode
DESCRIPTION
doctl databases is a subcommand of the DigitalOcean CLI tool (doctl) for managing Managed Databases. It allows creation, listing, retrieval, deletion, and configuration of database clusters supporting PostgreSQL, MySQL, MongoDB, and Redis.
Key operations include managing firewall rules, trusted sources, database users, backups, logs, connection details, resizing nodes, rebooting clusters, promoting primaries for high availability, and querying cluster metadata like types, regions, versions, VPCs, and tags.
Authentication requires a DigitalOcean API token set via doctl auth init. Output supports text, JSON, or YAML formats for scripting and automation. Ideal for DevOps workflows, infrastructure as code, and monitoring integrations.
Note that subcommands like create or resize have specific flags for engine, size, nodes, etc.
CAVEATS
Requires DigitalOcean account, API token, and enabled Managed Databases. Availability varies by region/engine; operations like resize may incur downtime or costs.
COMMON SUBCOMMANDS
list: List clusters.
create <engine>: Create cluster (e.g., pg, mysql).
get <id>: Get cluster details.
firewall-rule: Manage access rules.
connection: Get pooled connection URI.
resize: Scale cluster nodes.
EXAMPLE USAGE
doctl databases list --output json
doctl databases create mydb --type pg --region nyc1 --size db-s-1vcpu-1gb
doctl databases firewall-rule create <id> --type tag --value web
HISTORY
Part of doctl CLI released by DigitalOcean in 2017 (v1.0). Databases subcommand added ~2019 with Managed Databases launch, expanded with HA, Redis, MongoDB support in subsequent versions.


