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:
- Cloud Datastore Owner
(
roles/datastore.owner)
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
-
In the Google Cloud console, go to the Databases page.
- Click Create a Firestore database.
- Enter a database ID.
- Select a Firestore edition. See the editions overview to learn more about each edition.
- Select a data access mode. The data access mode configures which API and which client libraries you can use with your database.
- 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.
- Select a location.
- (Optional) If you need Customer-managed encryption keys (CMEK), expand and configure the encryption options.
- 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:
- DATABASE_ID: a valid database ID.