Create and Connect to a Database Cluster
Provision a managed Postgres database in a project and connect your application to it.
A database cluster is a fully managed Postgres database that lives inside one of your projects. This guide walks through creating a cluster, retrieving its connection string, connecting your application, and deleting the cluster when you no longer need it.
For background on how clusters scale and how they are billed, see Database Clusters and the Managed Postgres reference.
Prerequisites
- An organization on the Pro plan.
- A Phemeral project.
Create a Database Cluster
- Open your project in the dashboard.
- Go to the Database Clusters tab.
- Click New Cluster.
- Enter a cluster name. Names may contain letters, numbers, spaces, and hyphens, and must be unique within the project.
- Click Create Cluster.
Phemeral provisions the cluster and it appears in the project's cluster list. A project can hold up to 20 database clusters.
Get the Connection String
Each cluster exposes a connection URI that you can use to connect to your cluster.
- Open the project's Database Clusters tab and select the cluster.
- On the cluster's detail page, find the Connection URI field.
- Click the reveal (eye) button to display the connection string.
The pooled connection string is selected by default and is what you should use for most applications. It supports up to 10,000 concurrent connections and lets you connect directly without running your own connection pooler.
If you need a direct connection string instead—for example, for administrative tools or long-running sessions—you can uncheck the Pooled connection URI option before revealing the string.
Connect Your Application
Use the connection URI anywhere you would normally configure a Postgres connection.
For example, set it as an environment variable such as DATABASE_URL on the environment that needs database access, then read it in your application code.
Delete a Database Cluster
Deleting a cluster permanently destroys the database and all of its data. This cannot be undone!
- Open the project's Database Clusters tab and select the cluster.
- Click Delete Cluster.
- Type
deleteto confirm. - Click Confirm Deletion.
Deleting a cluster frees one of the project's 20 cluster slots.