doctl Verified current stable Not installed? Cloud Infrastructure

Doctl / Create Database Cluster

Create Database Cluster

Creates a new database cluster within the DigitalOcean infrastructure.

$
Terminal
doctl d c <database_name>

When To Use

When provisioning a fresh database environment for a new application or service.

Pro Tip

Consider specifying backups and high-availability settings initially; these cannot be altered post-creation.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
doctl d c <database_name>

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
$ doctl databases create my-database-cluster
Creating database cluster... Done!

Cluster Details:
+-------------------+---------------------+
| Name              | my-database-cluster |
| Engine            | postgres            |
| Version           | 13                  |
| Size              | db-s-1vcpu-1gb     |
| Region            | nyc1               |
| Status            | active              |
+-------------------+---------------------+

Anatomy of Output

Understanding the result

Creating new database cluster: <database_name> in <region>... Output Status

Indicates the initiation of the creation process.

Successfully created database cluster: <database_name>. Completion Status

Confirms successful database provisioning.

run 'doctl [[d|databases]] [[g|get]] <database_name>' for details. Next Steps

Suggests a command for retrieving detailed information on the new cluster.

Troubleshooting

Common pitfalls

Error: Database cluster <database_name> already exists

Solution: Choose a different name for the new database or check existing clusters.

Error: Invalid region specified

Solution: Refer to the available regions and ensure the selected region is correct.

Error: Insufficient resources to create database in <region>

Solution: Check the resource limits and try a different region or settings.

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.
c
c|create
The value supplied for c|create.
<database_name>
database name
The value supplied for database name.

How To Run

Execution path

  1. Step 1

    Run `doctl databases create my-database-cluster` to initiate cluster creation.

  2. Step 2

    Verify the cluster status with `doctl databases list`.

Alternative Approaches

Comparable commands in other tools

Alternative cloud infrastructure tools for the same job.