---
title: How to Create PostgreSQL Database Clusters
description: Create a PostgreSQL database cluster from the DigitalOcean Control Panel.
product: Databases
url: https://docs.digitalocean.com/products/databases/postgresql/how-to/create/
last_updated: "2026-07-30"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# How to Create PostgreSQL Database Clusters

PostgreSQL is an open source, object-relational database built for extensibility, data integrity, and speed. Its concurrency support makes it fully ACID-compliant, and it supports dynamic loading and catalog-driven operations to let users customize its data types, functions, and more.

You can create a PostgreSQL cluster using `doctl`, the API, or the Control Panel.

We currently support PostgreSQL major versions 14, 15, 16, 17, and 18. Clusters are provisioned with the latest supported minor release within a major version. To view available major versions for new clusters, use the [/v2/databases/options](https://docs.digitalocean.com/reference/api/reference/databases/index.html.md#databases_list_options) response.

## Create a Database Cluster Using Automation

You can create a database cluster using the DigitalOcean CLI (`doctl`) or the API.

### Create a Database Cluster via CLI

To create a database using `doctl`, you need to provide values for the `--engine`, `--region`, and `--size` flags. Use the [`doctl databases options engines`](https://docs.digitalocean.com/reference/doctl/reference/databases/options/engines/index.html.md), [`doctl databases options regions`](https://docs.digitalocean.com/reference/doctl/reference/databases/options/regions/index.html.md), and [`doctl databases options slugs`](https://docs.digitalocean.com/reference/doctl/reference/databases/options/slugs/index.html.md) commands, respectively, to get a list of available values.

## How to Create a Database Cluster Using the DigitalOcean CLI

1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI.
2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`.
3. Use the token to grant `doctl` access to your DigitalOcean account.

   ```shell
   doctl auth init
   ```
4. Run [`doctl databases create`](https://docs.digitalocean.com/reference/doctl/reference/databases/create/index.html.md). Basic usage:

   ```shell
   doctl databases create <name> [flags]
   ```

   The following example creates a PostgreSQL cluster named `example-database` in the `nyc1` region with a single 1 GB node:

   ```shell
   doctl databases create example-database --engine pg --version 18 --region nyc1 --size db-s-1vcpu-1gb --num-nodes 1
   ```

### Create a Database Cluster via API

To create a database using the API, you need to provide values for the `engine`, `region`, and `size` fields, which specify the database’s engine, its datacenter, and its configuration (number of CPUs, amount of RAM, and hard disk space). Use the [`/v2/databases/options`](https://docs.digitalocean.com/reference/api/reference/databases/index.html.md#databases_list_options) endpoint to get a list of available values.

## How to Create a Database Cluster Using the DigitalOcean API

### cURL

Send a POST request to `https://api.digitalocean.com/v2/databases` using cURL:

```shell
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{
    "name": "example-database",
    "engine": "pg",
    "version": "18",
    "region": "nyc1",
    "size": "db-s-1vcpu-1gb",
    "num_nodes": 1
  }' \
  "https://api.digitalocean.com/v2/databases"
```

### Go

Using [Godo](https://github.com/digitalocean/godo), the official DigitalOcean API client for Go:

```go
import (
    "context"
    "os"

    "github.com/digitalocean/godo"
)

func main() {
    token := os.Getenv("DIGITALOCEAN_TOKEN")

    client := godo.NewFromToken(token)
    ctx := context.TODO()

    createRequest := &godo.DatabaseCreateRequest{
        Name:       "example-database",
        EngineSlug: "pg",
        Version:    "18",
        Region:     "nyc1",
        SizeSlug:   "db-s-1vcpu-1gb",
        NumNodes:   1,
    }

    cluster, _, err := client.Databases.Create(ctx, createRequest)
}
```

### Python

Using [PyDo](https://github.com/digitalocean/pydo), the official DigitalOcean API client for Python:

```python
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

create_req = {
  "name": "example-database",
  "engine": "pg",
  "version": "18",
  "region": "nyc1",
  "size": "db-s-1vcpu-1gb",
  "num_nodes": 1
}

create_resp = client.databases.create_cluster(body=create_req)
```

## Create a Database Cluster Using the Control Panel

To create a database cluster, go to the [**Databases page**](https://cloud.digitalocean.com/databases), and then click **Create Database**. Or click **Create** at the top of any page and choose **Managed Database** from the **Data Services** section of the menu.

### Choose a Database Engine

On the **Create Database Cluster** page, in the **Choose a database engine** section, select **PostgreSQL**, and then choose a version, if available. The database engine and version can’t be changed after creation.

![The database engine selection portion of the database create page](https://docs.digitalocean.com/screenshots/databases/choose-database-engine.13ac1606e28d820633f2bf4d2257959aa5e7645a968992e25396517e1538c723.png)

### Choose a Database Configuration

In the **Choose a database configuration** section, select one of the following options:

- **Basic - Shared CPU**: CPU processing power is shared among neighboring Droplets on the same host. Best for low-traffic or development workloads.

  If you select this option, choose the type of disk under **CPU options**.
- **General Purpose - Dedicated CPU**: Provides the full processing power of a single vCPU at all times. Best for most workloads that need consistent CPU performance.
- **Storage-Optimized - Dedicated CPU**: Provides the full processing power of a single vCPU at all times. Best for workloads that require more storage and support more concurrent connections.

Under **Select a plan**, choose an option. Each option shows its combined monthly cost and included resources, such as vCPUs and memory.

After creation, you can [increase your cluster’s compute size](https://docs.digitalocean.com/products/databases/postgresql/how-to/resize/index.html.md) (number or size of nodes) at any time.

### Choose a Storage Size

In the **Choose a storage size** section, you can increase storage in 10 GiB increments, up to the maximum shown under **Storage range**. Additional storage you add to the cluster costs $0.21 per GiB per month.

![The Choose a Storage Size section of the database create page](https://docs.digitalocean.com/screenshots/databases/dbaas-choose-storage-size.76fbdc153eb2704b1df30b014ccbb9db2e98c476ace3b7b2959237150dd3d4b8.png)

You can [increase or decrease storage](https://docs.digitalocean.com/products/databases/postgresql/how-to/resize/index.html.md) at any time, but you cannot reduce it below the amount currently in use (or below what’s required by backups and growth).

In the **Autoscale storage** section, select **Enable Storage Autoscaling** to automatically increase storage when disk utilization on any node in the cluster reaches the specified threshold. The threshold is based on the worst-performing node in the cluster, not the average across nodes. Click **Customize** to set a custom threshold and storage increment. The system bills this increase as [additional storage](https://docs.digitalocean.com/products/databases/postgresql/details/pricing/index.html.md).

![The storage autoscaling section](https://docs.digitalocean.com/screenshots/databases/storage-autoscaling.abf053e0aa32de291b44f5cbda18c0a2a3ce16605b233651945149bc318500ce.png)

Autoscaling takes several minutes, depending on the cluster size. It runs without downtime and you do not need to take any action.

**Note**:

  When autoscaling occurs, the specified storage increment is added to each node in the cluster, not distributed across the cluster. The total added storage is approximately the increment multiplied by the number of nodes.

In the **Maximize uptime for critical workloads** section (available for all plans except the smallest, 1 vCPU / 1 GiB RAM / 10 GiB), you can add up to two standby nodes. Standby nodes ensure that your data stays available by giving your cluster high availability and failover.

### Choose a Datacenter Region

In the **Choose a datacenter region** section, select a datacenter for your cluster.

![The datacenter selection portion of the databases create page](https://docs.digitalocean.com/screenshots/databases/choose-a-datacenter.05781fd4b76cd5ac0442727585fed9be38bcde8699f944d06c66e6207b73ab2b.png)

The list shows the datacenters where you currently have the most resources, with the number of resources shown to the right as **X resources**. Hover over this text to see the specific resources in that datacenter.

For the best performance, create your database in the same datacenter as your other DigitalOcean resources.

After creation, you can [relocate your cluster to another datacenter](https://docs.digitalocean.com/products/databases/postgresql/how-to/relocate/index.html.md).

**Note**:

  Each region has one or more datacenters, each with its own [VPC](https://docs.digitalocean.com/products/networking/vpc/index.html.md) network. Keeping resources in the same datacenter ensures they share the private networking interface, which reduces latency and prevents traffic from being routed over the public internet.

### Finalize and Create

In the **Finalize and Create** section, enter a unique name for the cluster and select a project to add it to. After creation, you can move the cluster to another project, but its name can’t be changed.

![The Finalize and Create section of the Create a database page](https://docs.digitalocean.com/screenshots/databases/finalize-and-create.6312f8deb134ae6213e5cc19d885e11e943aa40d13544bc07f91e2faef9967bc.png)

When finished, click **Create Database Cluster**.

Clusters typically take five minutes or more to provision, but you can complete important configuration tasks such as [restricting inbound connections](https://docs.digitalocean.com/products/databases/postgresql/how-to/secure/index.html.md#firewalls) while you wait.