pydo.databases.create_cluster()
Generated on 3 Aug 2026
from pydo version
v0.40.0
Usage
client.databases.create_cluster(
body={
"name": "backend",
"engine": "mysql",
"version": "8",
...,
},
)Description
To create a database cluster, send a POST request to /v2/databases. To see a list of options for each engine, such as available regions, size slugs, and versions, send a GET request to the /v2/databases/options endpoint. The available sizes for the storage_size_mib field depends on the cluster’s size. To see a list of available sizes, see Managed Database Pricing.
The create response returns a JSON object with a key called database. The value of this is an object that contains the standard attributes associated with a database cluster. The initial value of the database cluster’s status attribute is creating. When the cluster is ready to receive traffic, this changes to online.
The embedded connection and private_connection objects contains the information needed to access the database cluster. For multi-node clusters, the standby_connection and standby_private_connection objects contain the information needed to connect to the cluster’s standby node(s).
DigitalOcean managed PostgreSQL and MySQL database clusters take automated daily backups. To create a new database cluster based on a backup of an existing cluster, send a POST request to /v2/databases. In addition to the standard database cluster attributes, the JSON body must include a key named backup_restore with the name of the original database cluster and the timestamp of the backup to be restored. Creating a database from a backup is the same as forking a database in the control panel.
PostgreSQL and MySQL Advanced Edition clusters can be provisioned by setting engine to advanced_pg or advanced_mysql. Advanced Edition clusters are currently in public preview and target highly available workloads. advanced_pg supports 1-, 2-, and 3-node deployments; advanced_mysql only supports 1- and 3-node deployments. See the PostgreSQL Advanced Edition and MySQL Advanced Edition documentation for the feature differences vs. Standard Edition and current preview limitations.
Note: Caching cluster creates are no longer supported as of 2025-04-30T00:00:00Z. Backups are also not supported for Caching or Valkey clusters.
Parameters
idstring optional read-onlyExample:
9cc10173-e9ea-4176-9dbc-a4cee4c4ff30A unique ID that can be used to identify and reference a database cluster.
namestring requiredExample:
backendA unique, human-readable name referring to a database cluster.
enginestring requiredA slug representing the database engine used for the cluster. The possible values are: "pg" for PostgreSQL, "mysql" for MySQL, "redis" for Caching, "mongodb" for MongoDB, "kafka" for Kafka, "opensearch" for OpenSearch, "valkey" for Valkey, "advanced_pg" for PostgreSQL Advanced Edition, and "advanced_mysql" for MySQL Advanced Edition. Advanced Edition engines are currently in public preview.
versionstring optionalExample:
8A string representing the version of the database engine in use for the cluster.
semantic_versionstring optional read-onlyExample:
8.0.28A string representing the semantic version of the database engine in use for the cluster.
num_nodesinteger requiredExample:
2The number of nodes in the database cluster.
sizestring requiredExample:
db-s-2vcpu-4gbThe slug identifier representing the size of the nodes in the database cluster.
regionstring requiredExample:
nyc3The slug identifier for the region where the database cluster is located.
statusstring optional read-onlyA string representing the current status of the database cluster.
created_atstring optional read-onlyExample:
2019-01-11T18:37:36ZA time value given in ISO8601 combined date and time format that represents when the database cluster was created.
private_network_uuidstring optionalExample:
d455e75d-4858-4eec-8c95-da2f0a5f93a7A 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.
Requiresvpc:readscope.tagsarray of strings or null optionalExample:
['production']An array of tags (as strings) to apply to the database cluster.
Requirestag:createscope.db_namesarray of strings or null optional read-onlyExample:
['doadmin']An array of strings containing the names of databases created in the database cluster.
ui_connectionobject optionalThe connection details for OpenSearch dashboard.
Show child properties
uristring optional read-onlyExample:
https://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060This is provided as a convenience and should be able to be constructed by the other attributes.
hoststring optional read-onlyExample:
backend-do-user-19081923-0.db.ondigitalocean.comThe FQDN pointing to the opensearch cluster's current primary node.
portinteger optional read-onlyExample:
25060The port on which the opensearch dashboard is listening.
userstring optional read-onlyExample:
doadminThe default user for the opensearch dashboard.
Requiresdatabase:view_credentialsscope.passwordstring optional read-onlyExample:
wv78n3zpz42xezdkThe randomly generated password for the default user.
Requiresdatabase:view_credentialsscope.sslboolean optional read-onlyExample:
TrueA boolean value indicating if the connection should be made over SSL.
schema_registry_connectionobject optionalThe connection details for Schema Registry.
Show child properties
uristring optional read-onlyExample:
https://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060This is provided as a convenience and should be able to be constructed by the other attributes.
hoststring optional read-onlyExample:
backend-do-user-19081923-0.db.ondigitalocean.comThe FQDN pointing to the schema registry connection uri.
portinteger optional read-onlyExample:
20835The port on which the schema registry is listening.
userstring optional read-onlyExample:
doadminThe default user for the schema registry.
Requiresdatabase:view_credentialsscope.passwordstring optional read-onlyExample:
wv78n3zpz42xezdkThe randomly generated password for the schema registry.
Requiresdatabase:view_credentialsscope.sslboolean optional read-onlyExample:
TrueA boolean value indicating if the connection should be made over SSL.
connectionobject optionalShow child properties
uristring optional read-onlyExample:
postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=requireA connection string in the format accepted by the
psqlcommand. This is provided as a convenience and should be able to be constructed by the other attributes.databasestring optional read-onlyExample:
defaultdbThe name of the default database.
hoststring optional read-onlyExample:
backend-do-user-19081923-0.db.ondigitalocean.comThe FQDN pointing to the database cluster's current primary node.
portinteger optional read-onlyExample:
25060The port on which the database cluster is listening.
userstring optional read-onlyExample:
doadminThe default user for the database.
Requiresdatabase:view_credentialsscope.passwordstring optional read-onlyExample:
wv78n3zpz42xezdkThe randomly generated password for the default user.
Requiresdatabase:view_credentialsscope.sslboolean optional read-onlyExample:
TrueA boolean value indicating if the connection should be made over SSL.
private_connectionobject optionalShow child properties
uristring optional read-onlyExample:
postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=requireA connection string in the format accepted by the
psqlcommand. This is provided as a convenience and should be able to be constructed by the other attributes.databasestring optional read-onlyExample:
defaultdbThe name of the default database.
hoststring optional read-onlyExample:
backend-do-user-19081923-0.db.ondigitalocean.comThe FQDN pointing to the database cluster's current primary node.
portinteger optional read-onlyExample:
25060The port on which the database cluster is listening.
userstring optional read-onlyExample:
doadminThe default user for the database.
Requiresdatabase:view_credentialsscope.passwordstring optional read-onlyExample:
wv78n3zpz42xezdkThe randomly generated password for the default user.
Requiresdatabase:view_credentialsscope.sslboolean optional read-onlyExample:
TrueA boolean value indicating if the connection should be made over SSL.
standby_connectionobject optionalShow child properties
uristring optional read-onlyExample:
postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=requireA connection string in the format accepted by the
psqlcommand. This is provided as a convenience and should be able to be constructed by the other attributes.databasestring optional read-onlyExample:
defaultdbThe name of the default database.
hoststring optional read-onlyExample:
backend-do-user-19081923-0.db.ondigitalocean.comThe FQDN pointing to the database cluster's current primary node.
portinteger optional read-onlyExample:
25060The port on which the database cluster is listening.
userstring optional read-onlyExample:
doadminThe default user for the database.
Requiresdatabase:view_credentialsscope.passwordstring optional read-onlyExample:
wv78n3zpz42xezdkThe randomly generated password for the default user.
Requiresdatabase:view_credentialsscope.sslboolean optional read-onlyExample:
TrueA boolean value indicating if the connection should be made over SSL.
standby_private_connectionobject optionalShow child properties
uristring optional read-onlyExample:
postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=requireA connection string in the format accepted by the
psqlcommand. This is provided as a convenience and should be able to be constructed by the other attributes.databasestring optional read-onlyExample:
defaultdbThe name of the default database.
hoststring optional read-onlyExample:
backend-do-user-19081923-0.db.ondigitalocean.comThe FQDN pointing to the database cluster's current primary node.
portinteger optional read-onlyExample:
25060The port on which the database cluster is listening.
userstring optional read-onlyExample:
doadminThe default user for the database.
Requiresdatabase:view_credentialsscope.passwordstring optional read-onlyExample:
wv78n3zpz42xezdkThe randomly generated password for the default user.
Requiresdatabase:view_credentialsscope.sslboolean optional read-onlyExample:
TrueA boolean value indicating if the connection should be made over SSL.
usersarray of objects or null optional read-onlyShow child properties
namestring requiredExample:
app-01The name of a database user.
rolestring optional read-onlyA string representing the database user's role. The value will be either
"primary" or "normal".passwordstring optional read-onlyExample:
jge5lfxtzhx42iffA randomly generated password for the database user.
Requiresdatabase:view_credentialsscope.access_certstring optional read-onlyExample:
-----BEGIN CERTIFICATE----- MIIFFjCCA/6gAwIBAgISA0AznUJmXhu08/89ZuSPC/kRMA0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FBwIBFhpodHRwOi8vY3BzLmxldHNlbmNyeXB0Lm9yZzCBqwYIKwYB BQUHAgIwgZ4MgZtUaGlzIENlcnRpZmljYXRlIG1heSBvbmx5IGJlIHJlbGllZCB1 cG9uIGJ5IFJlbHlpbmcgUGFydGllcyBhbmQgb25seSQ2ziBhY2NvcmRhbmNlIHdp dGggdGhlIENlcnRpZmljYXRlIFBvbGljeSBmb3VuZCBhdCBodHRwczovL2xldHNl bmNyeXB0Lm9yZy9yZXBvc2l0b3J5LzANBgkqhkiG9w0BAQsFAAOCAQEAOZVQvrjM PKXLARTjB5XsgfyDN3/qwLl7SmwGkPe+B+9FJpfScYG1JzVuCj/SoaPaK34G4x/e iXwlwOXtMOtqjQYzNu2Pr2C+I+rVmaxIrCUXFmC205IMuUBEeWXG9Y/HvXQLPabD D3Gdl5+Feink9SDRP7G0HaAwq13hI7ARxkL9p+UIY39X0dV3WOboW2Re8nrkFXJ7 q9Z6shK5QgpBfsLjtjNsQzaGV3ve1gOg25aTJGearBWOvEjJNA1wGMoKVXOtYwm/ WyWoVdCQ8HmconcbJB6xc0UZ1EjvzRr5ZIvSa5uHZD0L3m7/kpPWlAlFJ7hHASPu UlF1zblDmg2Iaw== -----END CERTIFICATE-----Access certificate for TLS client authentication. (Kafka only)
access_keystring optional read-onlyExample:
-----BEGIN PRIVATE KEY----- MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDBIZMz8pnK6V52 SVf+CYssOfCQHAx5f0Ou5rYbq3xNh8VHAIYJCQ1QxQIxKSP6+uODSYrb2KWyurP1 DwGb8OYm0J3syEDtCUQik1cpCzpeNlAZ2f8FzXyYQAqPopxdRpsFz8DtZnVvu86X wrE4oFPl9MReICmZfBNWylpV5qgFPoXyJ70ZAsTm3cEe3n+LBXEnY4YrVDRWxA3w Z2mzZ03HZ1hHrxK9CMnS829U+8sK+UneZpCO7yLRPuxwhmps0wpK/YuZZfRAKF1F ZRnak/SIQ28rnWufmdg16Yqq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WmRkjPI2+9ncDPRAllA7a8lnSV/Crph5N/AoGBAIK249temKrGe9pmsmAo QbNuYSmwpnMoAqdHTrl70HEmK7ob6SIVmsR8QFAkH7xkYZc4Bxbx4h1bdpozGB+/ AangbiaYJcAOD1QyfiFbflvI1RFeHgrk7VIafeSeQv6qu0LLMi2zUbpgVzxt78Wg eTuK2xNR0PIM8OI7pRpgyj1I -----END PRIVATE KEY-----Access key for TLS client authentication. (Kafka only)
mysql_settingsobject optionalShow child properties
auth_pluginstring requiredA string specifying the authentication method to be used for connections
to the MySQL user account. The valid values aremysql_native_password
orcaching_sha2_password. If excluded when creating a new user, the
default for the version of MySQL in use will be used. As of MySQL 8.0, the
default iscaching_sha2_password.
settingsobject optionalShow child properties
pg_allow_replicationboolean optionalExample:
TrueFor PostgreSQL clusters, set to
trueto grant the user replication
privileges. When omitted on create or update, the value defaults tofalseand replication privileges are not granted. This option is not
currently supported for other database engines.opensearch_aclarray of objects optionalACLs (Access Control Lists) specifying permissions on index within a OpenSearch cluster.
Show child properties
indexstring optionalExample:
index-abc.*A regex for matching the indexes that this ACL should apply to.
permissionstring optionalPermission set applied to the ACL. 'read' allows user to read from the index. 'write' allows for user to write to the index. 'readwrite' allows for both 'read' and 'write' permission. 'deny'(default) restricts user from performing any operation over an index. 'admin' allows for 'readwrite' as well as any operations to administer the index.
aclarray of objects optionalACLs (Access Control Lists) specifying permissions on topics within a Kafka cluster.
Show child properties
idstring optionalExample:
aaaAn identifier for the ACL. Will be computed after the ACL is created/updated.
topicstring requiredExample:
topic-abc.*A regex for matching the topic(s) that this ACL should apply to.
permissionstring requiredPermission set applied to the ACL. 'consume' allows for messages to be consumed from the topic. 'produce' allows for messages to be published to the topic. 'produceconsume' allows for both 'consume' and 'produce' permission. 'admin' allows for 'produceconsume' as well as any operations to administer the topic (delete, update).
mongo_user_settingsobject optionalMongoDB-specific settings for the user. This option is not currently supported for other database engines.
Show child properties
databasesarray of strings optionalExample:
['my-db', 'my-db-2']A list of databases to which the user should have access. When the database is set to
admin, the user will have access to all databases based on the user's role i.e. a user with the rolereadOnlyassigned to theadmindatabase will have read access to all databases.rolestring optionalThe role to assign to the user with each role mapping to a MongoDB built-in role.
readOnlymaps to a read role.readWritemaps to a readWrite role.dbAdminmaps to a dbAdmin role.
maintenance_windowobject optionalShow child properties
daystring requiredExample:
tuesdayThe day of the week on which to apply maintenance updates.
hourstring requiredExample:
14:00The hour in UTC at which maintenance updates will be applied in 24 hour format.
pendingboolean optional read-onlyExample:
TrueA boolean value indicating whether any maintenance is scheduled to be performed in the next window.
descriptionarray of strings optional read-onlyExample:
['Update TimescaleDB to version 1.2.1', 'Upgrade to PostgreSQL 11.2 and 10.7 bugfix releases']A list of strings, each containing information about a pending maintenance update.
project_idstring optionalExample:
9cc10173-e9ea-4176-9dbc-a4cee4c4ff30The 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.
Requiresproject:assign_resourcescope.rulesarray of objects optionalShow child properties
uuidstring optionalExample:
79f26d28-ea8a-41f2-8ad8-8cfcdd020095A unique ID for the firewall rule itself.
cluster_uuidstring optional read-onlyExample:
9cc10173-e9ea-4176-9dbc-a4cee4c4ff30A unique ID for the database cluster to which the rule is applied.
typestring requiredThe type of resource that the firewall rule allows to access the database cluster.
valuestring requiredExample:
ff2a6c52-5a44-4b63-b99c-0e98e7a63d61The ID of the specific resource, the name of a tag applied to a group of resources, or the IP address that the firewall rule allows to access the database cluster.
created_atstring optional read-onlyExample:
2019-01-11T18:37:36ZA time value given in ISO8601 combined date and time format that represents when the firewall rule was created.
descriptionstring optionalExample:
an IP address for local developmentA human-readable description of the rule.
version_end_of_lifestring optional read-onlyExample:
2023-11-09T00:00:00ZA timestamp referring to the date when the particular version will no longer be supported. If null, the version does not have an end of life timeline.
version_end_of_availabilitystring optional read-onlyExample:
2023-05-09T00:00:00ZA timestamp referring to the date when the particular version will no longer be available for creating new clusters. If null, the version does not have an end of availability timeline.
storage_size_mibinteger optionalExample:
61440Additional storage added to the cluster, in MiB. If null, no additional storage is added to the cluster, beyond what is provided as a base amount from the 'size' and any previously added additional storage.
metrics_endpointsarray of objects optional read-onlyPublic hostname and port of the cluster's metrics endpoint(s). Includes one record for the cluster's primary node and a second entry for the cluster's standby node(s).
Show child properties
hoststring optional read-onlyExample:
backend-do-user-19081923-0.db.ondigitalocean.comA FQDN pointing to the database cluster's node(s).
portinteger optional read-onlyExample:
9273The port on which a service is listening.
autoscaleobject optionalAutoscaling configuration for the database cluster. Currently only supports storage autoscaling. If null, autoscaling is not configured for the cluster.
Show child properties
storageobject optionalShow child properties
enabledboolean requiredExample:
TrueWhether storage autoscaling is enabled for the cluster
threshold_percentinteger optionalExample:
80The storage usage threshold percentage that triggers autoscaling. When storage usage exceeds this percentage, additional storage will be added automatically.
increment_gibinteger optionalExample:
10The amount of additional storage to add (in GiB) when autoscaling is triggered
do_settingsobject optionalShow child properties
service_cnamesarray of strings optionalExample:
['db.example.com', 'database.myapp.io']An array of custom CNAMEs for the database cluster. Each CNAME must be a valid RFC 1123 hostname (e.g., "db.example.com"). Maximum of 16 CNAMEs allowed, each up to 253 characters.
backup_restoreobject optionalShow child properties
database_namestring requiredExample:
backendThe name of an existing database cluster from which the backup will be restored.
backup_created_atstring optionalExample:
2019-01-31T19:25:22ZThe timestamp of an existing database cluster backup in ISO8601 combined date and time format. The most recent backup will be used if excluded.
Request Sample
Response Example
More Information
See /v2/databases in the API reference for additional detail on responses, headers, parameters, and more.