rsdo 0.1.20260901

A Rust client library for the DigitalOcean API v2
Documentation
operationId: databases_create_cluster

summary: Create a New Database Cluster

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](https://www.digitalocean.com/pricing/managed-databases).
  

  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](https://docs.digitalocean.com/products/databases/postgresql/how-to/use-advanced-edition-clusters/)
  and
  [MySQL Advanced Edition](https://docs.digitalocean.com/products/databases/mysql/how-to/use-advanced-edition-clusters/)
  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.

tags:
  - Databases

requestBody:
  required: true
  content:
    application/json:
      schema:
        allOf:
          - $ref: "models/database_cluster.yml"
          - type: object
            properties:
              backup_restore:
                $ref: "models/database_backup.yml"
      examples:
        Create a New Database Cluster:
          value:
            name: backend
            engine: pg
            version: "14"
            region: nyc3
            size: db-s-2vcpu-4gb
            storage_size_mib: 61440
            num_nodes: 2
            tags:
              - production

        Create a New Database Cluster with trusted sources:
          value:
            name: backend
            engine: pg
            version: "14"
            region: nyc3
            size: db-s-2vcpu-4gb
            num_nodes: 2
            storage_size_mib: 61440
            tags:
              - production
            rules:
              - type: ip_addr
                value: "192.168.1.1"
              - type: k8s
                value: ff2a6c52-5a44-4b63-b99c-0e98e7a63d61
              - type: droplet
                value: "163973392"
              - type: tag
                value: test
                description: "a test tag"

        Restore from a Database Cluster Backup:
          value:
            name: backend-restored
            backup_restore:
              database_name: backend
              backup_created_at: "2019-01-31T19:25:22Z"
            engine: pg
            version: "14"
            region: nyc3
            size: db-s-2vcpu-4gb
            num_nodes: 2

        Create a New Database Cluster with service CNAMEs:
          value:
            name: backend
            engine: pg
            version: "14"
            region: nyc3
            size: db-s-2vcpu-4gb
            num_nodes: 2
            storage_size_mib: 61440
            tags:
              - production
            do_settings:
              service_cnames:
                - "db.example.com"
                - "database.myapp.io"

        Create a New PostgreSQL Advanced Edition Cluster:
          value:
            name: backend-advanced
            engine: advanced_pg
            version: "18"
            region: nyc3
            size: db-s-2vcpu-4gb
            num_nodes: 3
            storage_size_mib: 61440
            tags:
              - production

        Create a New MySQL Advanced Edition Cluster:
          value:
            name: backend-advanced
            engine: advanced_mysql
            version: "8.4.8"
            region: nyc3
            size: db-s-2vcpu-4gb
            num_nodes: 3
            storage_size_mib: 61440
            tags:
              - production

        Create a Single-Node MySQL Advanced Edition Cluster:
          value:
            name: backend-advanced-single
            engine: advanced_mysql
            version: "8.4.8"
            region: nyc3
            size: db-s-2vcpu-4gb
            num_nodes: 1
            storage_size_mib: 61440
            tags:
              - production

responses:
  "201":
    $ref: "responses/database_cluster.yml"

  "401":
    $ref: "../../shared/responses/unauthorized.yml"

  "404":
    $ref: "../../shared/responses/not_found.yml"

  "429":
    $ref: "../../shared/responses/too_many_requests.yml"

  "500":
    $ref: "../../shared/responses/server_error.yml"

  default:
    $ref: "../../shared/responses/unexpected_error.yml"

x-codeSamples:
  - $ref: "examples/curl/databases_create_cluster.yml"
  - $ref: "examples/go/databases_create_cluster.yml"
  - $ref: "examples/python/databases_create_cluster.yml"

security:
  - bearer_auth:
      - "database:create"