Reading Data from Cloud Bigtable with Cloud Functions

1.75 hours
  • 4 Learning Objectives

About this Hands-on Lab

Cloud Bigtable can store petabytes of data — and Cloud Functions can access any of that data, parse it, and send it on to another service. In this hands-on lab, you’ll first create a Bigtable instance as well as a table and populate it with test data. Then you’ll build an HTTP-triggered Cloud Function to read specific elements of that data and output it for verification.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Enable APIs

Enable the APIs necessary for creating a Cloud Function.

Create and Prepare the Cloud Bigtable Instance

Create a Cloud Bigtable instance and then connect to it in the Cloud Shell so that you can create a test table and populate it with sample data.

Retrieve the Working Files

Clone a Github repository to access the source files for the Cloud Function.

Create and Test the Cloud Function

Create, deploy, and test a Cloud Function, triggered by HTTP, to read and output selected data from Cloud Bigtable.

Additional Resources

In this scenario, your team is tracking the hold status of a set of objects in a particular Cloud Storage bucket and wants to be notified if the status changes. You decide to set up a Cloud Function that will write an entry to the log when triggered by a change to the metadata that outputs the current hold status.


Working Files Repository

Test Table Code

   cbt createtable test-table "families=stats_summary:maxversions=2,stats_detail:maxversions=2,cell_plan:maxversions=2"

Populate Table Code

   cbt set test-table phone#4c410523#20190501 stats_summary:connected_cell=1 stats_summary:connected_wifi=1 stats_summary:os_build=PQ2A.190405.003 cell_plan:data_plan_01gb=true cell_plan:data_plan_05gb=true
    cbt set test-table phone#4c410523#20190502 stats_summary:connected_cell=1 stats_summary:connected_wifi=1 stats_summary:os_build=PQ2A.190405.004 cell_plan:data_plan_05gb=true
    cbt set test-table phone#4c410523#20190505 stats_summary:connected_cell=0 stats_summary:connected_wifi=1 stats_summary:os_build=PQ2A.190406.000
    cbt set test-table phone#5c10102#20190501 stats_summary:connected_cell=1 stats_summary:connected_wifi=1 stats_summary:os_build=PQ2A.190401.002 cell_plan:data_plan_10gb=true
    cbt set test-table tablet#5c10102#20190502 stats_summary:connected_cell=1 stats_summary:connected_wifi=0 stats_summary:os_build=PQ2A.190406.000 cell_plan:data_plan_10gb=true

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?