Search code examples
google-cloud-platformgoogle-cloud-datastore

How can I make a Google DataStore database publicy readable?


I have a Datastore instance that contains public data. I want website users to query the database when they visit a particular url. Once the data is fetched, I'll use javascript to aggregate and display the data. It's a static site so I can't do this from a back end.

Is it possible to do this without creating a service account and using credentials? Cloud functions has the allUsers permission and I was hoping there is something similar for Datastore?

If it isn't possible to make the data public, I guess I could use a Cloud function. But I'd like to confirm there isn't a simpler solution first.


Solution

  • This is a use case that's supported with Firestore in Native mode and the Firebase Web SDK (docs).

    For Datastore, you are correct. You would need to use a something like a Cloud Function to make a back-end. By default, the Cloud Function service account has permission to access to a Datastore database in the same project.