Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru

Setting Up for Google Cloud Spanner

Today’s global companies require a global solution for their extensive data needs. Cloud Spanner provides a highly available, SQL-compliant database solution capable of scaling horizontally on a planet-wide scale. In this hands-on lab, you’ll walk through the process of establishing a Cloud Spanner instance, creating a populated database, querying the data, and then exporting it to Google Cloud Storage


Path Info

Clock icon Beginner
Clock icon 30m
Clock icon Mar 12, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Enable APIs

    1. From the Google Cloud console navigation, choose APIs & Libraries > Libraries.
    2. Enable the APIs for Cloud Spanner, Dataflow, and Cloud Storage.
  2. Challenge

    Create a Cloud Spanner Instance

    1. From the main navigation, choose Spanner in the Storage section.
    2. Click Create instance.
    3. Provide the following details:
      • Name: la-spanner
      • Configuration: Regional - us-central1
      • Node: 1
    4. Click Create.
  3. Challenge

    Create Database and Table

    1. Click Create database.
    2. Name the database.
    3. Leave the dialect set to Google Standard SQL.
    4. In the Define your schema section enter the following code in the DDL statements box: CREATE TABLE Artists ( ArtistId INT64 NOT NULL, FirstName STRING(1024), LastName STRING(1024), BirthDate DATE ) PRIMARY KEY(ArtistId);
    5. Click Create.
  4. Challenge

    Populate Table

    1. Select Artists in left sidebar.
    2. Review the schema.
    3. Click Data.
    4. Click Insert and a query window will open.
    5. In the values section of the query, enter the following records between the parentheses making sure to replace the example data
    6. Click Format Query and wait for the query to show as valid.
    7. Click Run:
  5. Challenge

    Edit Data

    1. Click on Data.
    2. Select the checkbox next to the Frida Kahloe record.
    3. Choose Edit.
    4. In the SET section of the query, change the LastName to Kahlo.
    5. Click Run.
  6. Challenge

    Query Data

    1. In the query window, click New Tab.
    2. In the Query field, enter: SELECT * from Artists WHERE BirthDate > '1900-01-01'*.
    3. Click Run.
    4. Review results.
  7. Challenge

    Create Bucket and Export Data

    1. Navigate to Storage.
    2. Click Create Bucket.
    3. Provide the following details:
      • Name: la-spanner-export-<INSERT NUMBERS OR LETTERS HERE> (must be unique across all Cloud Storage)
      • Default storage class: Regional
      • Location: us-central1
    4. Click Create.
    5. Leave the public access prevention setting as the default.
    6. Navigate back to Spanner.
    7. Choose instance from left sidebar.
    8. Select Export.
    9. Select bucket to store exported data.
    10. Choose database to export.
    11. Select region.
    12. Click Confirm Charges checkbox.
    13. Click Export
    14. Visit Cloud Spanner to view progress of operation.
    15. Visit Cloud Storage bucket to confirm operation.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans