Google Cloud Platform
Cloud Datastore

Sign Up

This page describes how to activate the Google Cloud Datastore API, the quotas associated with this API, and how to enable billing. The activation process varies based on your existing setup and environment.

Accessing the Datastore API from a Compute Engine instance

This section shows how to activate and access the Cloud Datastore API from a Compute Engine VM instance in a new or existing Cloud project.

  1. Use the Enable Datastore API Wizard to activate the Datastore API. The wizard allows you to activate the API for an existing project, or create a new project and activate it for that.
  2. Use the Enable Google Compute Engine Wizard to activate the Google Compute Engine API for the project you selected or created in the previous step.
  3. Enable billing for your project.

    Go to the Billing page

  4. Create a Compute Engine instance.

Console

  1. In the Cloud Platform Console, go to the VM Instances page.
  2. Click the Create instance button.
  3. In the Identity and API access section, set Access scopes to provide access for Datastore. Either click Allow full access to all Cloud APIs to grant access to all Google Cloud APIs, or click Set access for each API, click the dropdown for Cloud Datastore, and then click Enabled to grant access to Cloud Datastore.
  4. Click the Create button to create the instance.
  5. Confirm that your instance is running.
  6. To use this new Compute Engine instance, connect to it using your browser.

gcloud

  1. If you haven't already done this, install the gcloud tool and set up gcloud compute.
  2. Add a Google Compute Engine instance and start it, following the instructions for starting an instance in the Google Compute Engine documentation. Specify the project ID, the instance name, and the datastore scope as shown here:

    $ PROJECT_ID=<project-id>        # replace <project-id> with the Project ID you created previously.
    $ INSTANCE_NAME=<instance-name>  # replace <instance-name> with the name you want to use for your instance.
    $ gcloud compute instances create $INSTANCE_NAME --project $PROJECT_ID --scopes datastore
    
  3. Confirm that your instance is running.

  4. To use this new Compute Engine instance, connect to it using ssh.

At this point all services and authorizations are configured for your project and you can start writing code or exploring the API.

Accessing the Datastore API from another platform

This section shows how to activate and access the Cloud Datastore API from an external application running on a platform outside of Google Cloud.

  1. Use the Enable Datastore API Wizard to activate the Datastore API. The wizard allows you to activate the API for an existing project, or create a new project and activate it for that.
  2. In the Create service account page, select P12 for the file format used for the key.
  3. Click Create.
  4. Upon successful creation, a prompt displays the key file name and password: note the file name so you can locate it, then click OK to dismiss. Your browser will download the private key.
  5. Your Service Account is the Email address displayed under the Service Account section.
  6. Your Private Key is the file you just downloaded.

At this point all services and authorizations are configured for your project and you can start writing code or exploring the API.

Accessing an existing App Engine Datastore from a Compute Engine instance

This section shows how to activate and access an existing App Engine Datastore from an Compute Engine instance. This scenario is focused on users who want to share data between an existing App Engine application and a Compute Engine instance.

  1. Visit the App Engine Administration Console.
  2. Select the Application ID for which the Cloud Datastore API should be enabled.
  3. In the left sidebar, click the Application Settings.
  4. In the Basics section, find the Google APIs Console Project Number and click it to go to the dashboard of the project containing the App Engine application.

    Note: New App Engine applications are automatically created with a Cloud Platform Console project, which is required if your App Engine app needs to work with other Cloud Platform products or use other Google APIs. However, older legacy App Engine applications were not created with a Cloud Platform Console project. If your application does not have an associated project, create one (and populate the Google APIs Console Project Number field) by following the instructions How do I create a Cloud Platform Console project for App Engine.

  5. Use the Enable Datastore API Wizard to activate the Datastore API for the project that contains the App Engine application.

  6. Use the Enable Google Compute Engine Wizard to activate the Google Compute Engine API for the project.
  7. Check that billing is enabled for the project.
  8. Create a Compute Engine instance.

Console

  1. In the Cloud Platform Console, go to the VM Instances page.
  2. Click the Create instance button.
  3. In the Identity and API access section, set Access scopes to provide access for Datastore. Either click Allow full access to all Cloud APIs to grant access to all Google Cloud APIs, or click Set access for each API, click the dropdown for Cloud Datastore, and then click Enabled to grant access to Cloud Datastore.
  4. Click the Create button to create the instance.
  5. Confirm that your instance is running.
  6. To use this new Compute Engine instance, connect to it using your browser.

gcloud

  1. If you haven't already done this, install the gcloud tool and set up gcloud compute.
  2. Add a Google Compute Engine instance and start it, following the instructions for starting an instance in the Google Compute Engine documentation. Specify the project ID, the instance name, and the datastore scope as shown here:

    $ PROJECT_ID=<project-id>        # replace <project-id> with the Project ID you created previously.
    $ INSTANCE_NAME=<instance-name>  # replace <instance-name> with the name you want to use for your instance.
    $ gcloud compute instances create $INSTANCE_NAME --project $PROJECT_ID --scopes datastore
    
  3. Confirm that your instance is running.

  4. To use this new Compute Engine instance, connect to it using ssh.

At this point all services and authorizations are configured for your project and you can start writing code or exploring the API.

Accessing an existing App Engine Datastore from another platform

This section shows how to activate and access an existing App Engine Datastore from an external application running on a platform outside of Google Cloud.

  1. Visit the App Engine Administration Console.
  2. Select the Application ID for which the Cloud Datastore API should be enabled.
  3. In the left sidebar, click the Application Settings.
  4. In the Basics section, find the Google APIs Console Project Number and click it to go to the dashboard of the project containing the App Engine application.

    Note: New App Engine applications are automatically created with a Cloud Platform Console project, which is required if your App Engine app needs to work with other Cloud Platform products or use other Google APIs. However, older legacy App Engine applications were not created with a Cloud Platform Console project. If your application does not have an associated project, create one (and populate the Google APIs Console Project Number field) by following the instructions How do I create a Cloud Platform Console project for App Engine.

  5. Use the Enable Datastore API Wizard to activate the Datastore API for the project that contains the App Engine application.

  6. Check that billing is enabled for the project.
  7. In the Create service account page, select P12 for the file format used for the key.
  8. Click Create.
  9. Upon successful creation, a prompt displays the key file name and password: note the file name so you can locate it, then click OK to dismiss. Your browser will download the private key.
  10. Your Service Account is the Email address displayed under the Service Account section.
  11. Your Private Key is the file you just downloaded.

At this point all services and authorizations are configured for your project and you can start writing code or exploring the API.

Quotas and billing

A certain amount of free quota is available, as described in Pricing and Quota. This means you aren't required to enable billing to get started or to use Cloud Datastore up to the free quota limits. However, if you need more resources than is provided by the free quota, you must enable billing and set a budget for your project.

Enabling billing and setting a budget

In order to gain access to higher quotas than the free quotas, you must enable billing and you must also set a budget.

The budget is a daily limit: it sets the maximum dollar amount of resources you will be charged for each day. After this limit is reached, no further costs will be incurred, but also, no further billable Cloud Datastore operations will be allowed. You'll need to specify a budget because the initial default budget is always 0, which means by default you cannot exceed the free quota, even with billing enabled.

To enable billing:

  1. In the Cloud Platform Console, go to the Billing page.

    Go to the Billing page

  2. Click New billing account.
  3. Fill out your billing information, and then click Accept and start free trial.

To set a budget:

  1. In App Engine Settings, click Edit.
  2. Specify the daily budget amount in USD and then click Save.