Connecting to Cloud Bigtable with cbt

30 minutes
  • 6 Learning Objectives

About this Hands-on Lab

Sometimes data is relatively straight-forward — there’s just an overwhelming amount of it. That’s exactly what Cloud Bigtable is meant for. Cloud Bigtable is a fully managed NoSQL database service designed to handle massive amounts of information. In this hands-on lab, you’ll configure database instances and clusters for Cloud Bigtable in the console and then use command line `cbt` commands to create a schema and populate the table with data.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Enable API
  1. From the main navigation, choose APIs & Services > Library.
  2. In the search field, enter Bigtable.
  3. Select the Cloud Bigtable Admin API card.
  4. Click Enable.
Create Bigtable Instance
  1. From the main navigation, choose Bigtable in the Storage section.
  2. Choose Create instance.
  3. Set the following fields:
    • Instance Name: la-data-cbt
    • Storage type: HDD
    • Cluster Region: us-east1
    • Cluster Zone: us-east1-b
  4. Click Done and then Create.
Install and Configure `cbt`
  1. Activate the Cloud Shell by clicking its icon in the top row.

  2. Configure cbt with the following commands:
    echo "project = ${DEVSHELL_PROJECT_ID}" > ~/.cbt
    echo instance = la-data-cbt >> ~/.cbtrc

    Note: If you do not have the cbt sdk installed then do the following:

  3. In the Cloud Shell, enter the following:
    gcloud components update
    gcloud components install cbt

Create Data Table
  1. In the Cloud Shell, enter the following:

    cbt createtable la-table
    cbt ls
Define Table Structure and Add Data
  1. In the Cloud Shell, enter the following:
    cbt createfamily la-table offerings
    cbt set la-table r1 offerings:c1=labs
    cbt read la-table

  2. Review results.

  3. Enter the following:
    cbt set la-table r1 offerings:c2=courses
    cbt read la-table

Delete Bigtable Instance
  1. From the console, select the Bigtable instance.
  2. Choose Delete instance.

Additional Resources

In preparation for an Internet of Things project involving a great deal of streaming real-time data, you’ve been asked to get up to speed on Cloud Bigtable. You’ll need to learn how to create instances and then, using the command line cbt commands, define the initial table and its structure.

You’ll need to accomplish the following steps to complete your task:

  1. Enable APIs.
  2. Create Cloud Bigtable instance.
  3. Install and configure cbt.
  4. Create data table.
  5. Define table structure and add data.
  6. Delete Bigtable instance.

What are Hands-on Labs

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.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?