This page describes how to configure the Firestore in Datastore mode client libraries to use a regional endpoint.
When you use Firestore in Datastore mode client libraries, you can use either of the following endpoints:
Global endpoint: By default, the Firestore in Datastore mode client libraries send API requests to a global service endpoint named
datastore.googleapis.com
. The global service endpoint routes the request to your database. During routing, the request might pass through a regional service endpoint in a location that's different from your database location.Regional endpoint: A regional endpoint enforces regional restrictions, ensuring that data is stored and processed in a specified region. To guarantee that the service endpoint processes your app's Firestore in Datastore mode requests in the same region as your database, specify a regional endpoint in the client library.
Set a regional endpoint
The following examples show how to set a regional endpoint when you initialize a Firestore in Datastore mode client.
Java
To learn how to install and use the client library for Datastore mode, see Datastore mode client libraries. For more information, see the Datastore mode Java API reference documentation.
To authenticate to Datastore mode, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To learn how to install and use the client library for Datastore mode, see Datastore mode client libraries. For more information, see the Datastore mode Python API reference documentation.
To authenticate to Datastore mode, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Regional endpoint semantics
Firestore in Datastore mode supports regional endpoints for both region and multi-region locations.
Use the following format to define regional endpoints:
Java
https://REGION_NAME-firestore.googleapis.com:443
Make sure that the complete https
URL is used and that the port number is defined along with the endpoint.
Python
https://REGION_NAME-firestore.googleapis.com
Make sure that the complete https
URL is set as the regional endpoint.
Go
REGION_NAME-firestore.googleapis.com:443
Make sure that the port number is defined along with the endpoint.
Replace REGION_NAME with the name of a regional or multi-regional hostnames.
Some examples of hostnames are:
eur3-datastore.googleapis.com
nam5-datastore.googleapis.com
europe-west6-datastore.googleapis.com
asia-northeast2-datastore.googleapis.com
For a complete list of multi-regional and regional hostnames, see Firestore in Datastore mode locations.
What's next
- Learn about the Firestore in Datastore mode data model. See Entities, properties, and keys.
- See the Best practices for Firestore in Datastore mode.