This page describes how to create a PostgreSQL database in an AlloyDB cluster.
To create a database in an AlloyDB cluster, you connect a psql
client to the cluster's primary instance and then run a PostgreSQL CREATE
DATABASE
command.
Before you begin
- The Google Cloud project you are using must have been enabled to access AlloyDB.
- You must have one of these IAM roles in the Google Cloud project you are using:
roles/alloydb.admin
(the AlloyDB Admin predefined IAM role)roles/owner
(the Owner basic IAM role)roles/editor
(the Editor basic IAM role)
If you don't have any of these roles, contact your Organization Administrator to request access.
Procedure
- Connect a
psql
client to the cluster's primary instance, as described in Connect a psql client to an instance. - At the
psql
command prompt, enter aCREATE DATABASE
command, as described in the PostgreSQL documentation. For example:CREATE DATABASE DATABASE_NAME;
Follow the PostgreSQL rules in Identifiers and Key Words when you create your database name.