Hide
Google Cloud Datastore
  • Scalable datastore for clients. Google Cloud Datastore is a fully managed, schemaless database for storing non- relational data. Cloud Datastore automatically scales with your users and supports ACID transactions, high availability of reads and writes, strong consistency for reads and ancestor queries, and eventual consistency for all other queries.

  • Your data in the cloud. Each Cloud Datastore instance is fully managed by Google so there is no planned downtime, replication across multiple datacenters, automatic scaling as your traffic increases, and monitoring by Google Engineers.

  • Easy and flexible administration Cloud Datastore is accessible via HTTP using a JSON or Protocol Buffers API, running on top of the Google APIs infrastructure. Cloud Datastore offers Protocol Buffer client libraries for Java and Python as well as support for the Google APIs client libraries. In addition, Cloud Datastore offers a web-based interface for managing your Cloud Datastore instances, and a development server to support local development.

Try it now

Sign up

  1. If you don't already have one, sign up for a Google account.
  2. Create a Google Cloud Datastore enabled project via the Google Developers Console.
  3. Enable billing from your project's Settings tab.
  4. Enable the Google Cloud Datastore API.

Create a Google Compute instance

Developers Console


  1. From your project's overview page, in the left sidebar, select Compute Engine.
  2. Click New instance.
  3. In the NAME box, enter hello-datastore.
  4. In the ZONE box, select the us-central1-a zone.
  5. In the IMAGE box, choose Debian-7.
  6. Click Create.

Cloud SDK on Linux or Mac OS X


  1. Download and install the Cloud SDK.

    You can download and install the Cloud SDK using the following command:

    $ curl https://sdk.cloud.google.com | bash
  2. Restart your terminal to allow changes to your PATH to take affect.

    You can also run source ~/.<bash-profile-file> if you want to avoid restarting your terminal.

  3. Authenticate to the Google Cloud platform by running:
    $ gcloud auth login
  4. Create an instance.
    $ gcloud compute instances create hello-datastore --project <PROJECT_ID>  --zone us-central1-a \
                    --scopes datastore userinfo-email

    Replace <PROJECT_ID> with an existing project ID or the one you just created.

Cloud SDK on Windows


  1. Download the Cloud SDK and install it.
  2. Launch GoogleCloudSDKInstaller.exe and follow the installation prompts.
  3. Authenticate to the Google Cloud platform by running:
    $ gcloud auth login
  4. Create an instance.
    $ gcloud compute instances create hello-datastore --project <PROJECT_ID>  --zone us-central1-a \
                   --scopes datastore userinfo-email

    Replace <PROJECT_ID> with an existing project ID or the one you just created.

Write data to Google Cloud Datastore from the instance

  1. Connect to the instance using ssh. In the following command, substitute your project's ID for <PROJECT_ID>.
    $ gcloud compute ssh hello-datastore --project <PROJECT_ID> --zone us-central1-a
  2. Install the googledatastore package, and download and unzip the latest version of the google-cloud-datastore samples. This step requires virtualenv and pip.
    $ virtualenv gcd
    $ gcd/bin/pip install googledatastore==v1beta2-rev1-2.1.0
    
    $ wget https://github.com/GoogleCloudPlatform/google-cloud-datastore/archive/v1beta2-rev1-2.1.1.zip
    $ unzip v1beta2-rev1-2.1.1.zip
    $ gcd/bin/pip install -r google-cloud-datastore-1beta2-rev1-2.1.1/python/requirements.txt
  3. Run the sample code to write an entity to the datastore. In the following command, substitute your project's ID for <PROJECT_ID>.
    $ gcd/bin/python google-cloud-datastore-1beta2-rev1-2.1.1/python/demos/trivial/adams.py <PROJECT_ID>
    Meaning of life?
    > 42
    fascinating, extraordinary and, when you think hard about it, completely obvious.
    
  4. Optionally, in the Developers Console, view the entity.

    From your project's overview page, select Cloud Datastore and then Query.

    Using Google Developers Console to verify written entity.

What next?