Manage databases

This page describes how to create, update, and delete Firestore in Datastore mode databases. You can create multiple Firestore databases per project. You can use multiple databases to set up production and testing environments, to isolate customer data, and for data regionalization.

Required roles and permissions

To create and manage databases, you'll need the following Identity and Access Management role:

That role grants the following permissions that you need to create and manage databases:

  • Create a database: datastore.databases.create
  • Read database configuration: datastore.databases.getMetadata
  • Configure a database: datastore.databases.update
  • Delete a database: datastore.databases.delete
  • Clone a database: datastore.databases.clone

Create a database

To create a database, use one of the following methods:

Console
  1. In the Google Cloud console, go to the Databases page.

    Go to Databases

  2. Click Create a Firestore database.
  3. Enter a database ID.
  4. Select a Firestore edition. See the editions overview to learn more about each edition.
  5. Select a data access mode. The data access mode configures which API and which client libraries you can use with your database.
  6. If you select Firestore in Native mode:
    • Configure your initial security rules. Select Restrictive if you don't plan to use the Firebase mobile and web SDKs.
    • If you selected Enterprise edition, enable or disable real-time updates for your database.
  7. Select a location.
  8. (Optional) If you need Customer-managed encryption keys (CMEK), expand and configure the encryption options.
  9. Click Create Database.
gcloud

Use the gcloud firestore databases create command.

  • To create a Firestore Standard edition database:

    gcloud firestore databases create \
    --database=DATABASE_ID \
    --location=LOCATION \
    --edition=standard
    --type=DATABASE_TYPE

    Replace the following: