database_cluster
Generated on 30 Jun 2025
from digitalocean.cloud
version
v1.2.1
Synopsis
Create or delete database clusters. DigitalOcean’s managed database service simplifies the creation and management of highly javailable database clusters. Currently, it offers support for PostgreSQL, Valkey, MySQL, and MongoDB. Database clusters may be deployed in a multi-node, high-availability configuration. If your machine type is above the basic nodes, your node plan is above the smallest option, or you are running MongoDB, you may additionally include up to two standby nodes in your cluster. The size of individual nodes in a database cluster is represented by a human-readable slug, which is used in some of the following requests. Each slug denotes the node’s identifier, CPU count, and amount of RAM, in that order. View the create API documentation at https://docs.digitalocean.com/reference/api/api-reference/#tag/Databases.
Requirements
- pydo >= 0.1.3
- azure-core >= 1.26.1
Parameters
Parameter | Choices / Default | Description |
---|---|---|
backup_restore dict |
Object (database_backup) | |
client_override_options dict |
Client override options (developer use). For example, can be used to override the DigitalOcean API endpoint for an internal test suite. If provided, these options will knock out existing options. | |
engine str / required |
Choices:
|
A slug representing the database engine used for the cluster. The possible values are “pg” for PostgreSQL, “mysql” for MySQL, “valkey” for Valkey, and “mongodb” for MongoDB. |
module_override_options dict |
Module override options (developer use). Can be used to override module options to support experimental or future options. If provided, these options will knock out existing options. | |
name str / required |
A unique, human-readable name referring to a database cluster. | |
num_nodes int |
Default: 1 |
The number of nodes in the database cluster. |
private_network_uuid str |
A string specifying the UUID of the VPC to which the database cluster will be assigned. If excluded, the cluster when creating a new database cluster, it will be assigned to your account’s default VPC for the region. | |
project_id str |
The ID of the project that the database cluster is assigned to. If excluded when creating a new database cluster, it will be assigned to your default project. | |
region str / required |
The slug identifier for the region where the database cluster is located. | |
rules list / elements=dict |
Array of objects (firewall_rule) | |
size str |
Default: db-s-1vcpu-1gb |
The slug identifier representing the size of the nodes in the database cluster. |
state str |
Choices:
|
State of the resource, present to create, absent to destroy. |
tags list / elements=str |
An array of tags that have been applied to the database cluster. | |
timeout int |
Default: 300 |
Polling timeout in seconds. |
token str |
DigitalOcean API token. There are several environment variables which can be used to provide this value. DIGITALOCEAN_ACCESS_TOKEN , DIGITALOCEAN_TOKEN , DO_API_TOKEN , DO_API_KEY , DO_OAUTH_TOKEN and OAUTH_TOKEN |
|
version str |
A string representing the version of the database engine in use for the cluster. |
Examples
- name: Create Postgres database cluster
digitalocean.cloud.database_cluster:
token: "{{ token }}"
state: present
name: backend
region: nyc3
type: pg
num_nodes: 2
size: db-s-2vcpu-4gb
Return Values
Key | Returned | Description |
---|---|---|
database dict |
always | Database information. Sample:
|
error dict |
failure | DigitalOcean API error. Sample:
|
msg str |
always | Droplet result information. Sample:
|