
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create a Bigtable instance
/ 20
Simulate streaming traffic sensor data into Pub/Sub
/ 20
Launch dataflow pipeline
/ 20
Stop streaming jobs and delete Bigtable data
/ 20
Bigtable is Google's fully managed, scalable NoSQL database service. Bigtable is ideal for storing large amounts of data in a key-value store and for use cases such as personalization, ad tech, financial tech, digital media, and Internet of Things (IoT). Bigtable supports high read and write throughput at low latency for fast access to large amounts of data for processing and analytics.
For streaming data from sensors, Bigtable can handle high writes to capture large volumes of real-time data.
In this lab, you use commands to create a Bigtable instance with a table to store simulated traffic sensor data. Then you launch a Dataflow pipeline to load the simulated streaming data from Pub/Sub into Bigtable. While the Dataflow job loads streaming data from Pub/Sub into Bigtable, you verify that the table is being successfully populated. You complete the lab by stopping the streaming job and deleting the Bigtable data.
In this lab, you learn how to create a Bigtable instance and table using commands and use Dataflow to load streaming data.
gcloud
CLI) commands.cbt
CLI) commands.Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details panel.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details panel.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud
is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud
, in Google Cloud, refer to the gcloud CLI overview guide.
To create a new table in Bigtable, you first need to create a Bigtable instance to store your table. To create a Bigtable instance, you can use the Google Cloud console, gcloud
CLI commands, or cbt
CLI commands.
In this task, you use Cloud Shell to first run gcloud
CLI commands to create a new Bigtable instance, and then run cbt
CLI commands to connect to Bigtable and create a new table.
For a review of how to access Cloud Shell, click Setup and requirements on the right-side menu of this page.
This command creates a new Bigtable instance with the following properties:
Property | Value |
---|---|
Instance ID | sandiego |
Instance display name | San Diego Traffic Sensors |
Storage Type | SSD |
Cluster ID | sandiego-traffic-sensors-c1 |
Zone | |
Node scaling mode | Manual allocation |
Number of nodes | 1 |
When you receive the output message, continue to the next step.
To connect to Bigtable using cbt
CLI commands, you first need to use Cloud Shell to update the .cbtrc
configuration file with your project ID and your Bigtable instance ID.
.cbtrc
file with the project ID and instance ID, run the following commands:.cbtrc
file, run the following command:The output should resemble the following:
After you configure the .cbtrc
configuration file in Cloud Shell, you can run a simple cbt
CLI command to create a new Bigtable table with column families.
Click Check my progress to verify the objective.
In this task, you run a streaming data simulator from a Compute Engine virtual machine (VM) that has been created for this lab. To begin this task, you will enter commands on a VM named training-vm to set up your environment and download the necessary files for the streaming data simulator.
In the Google Cloud console, on the Navigation menu, click Compute Engine > VM instances.
Locate the line with the instance called training-vm, and under Connect, click SSH.
A terminal window for training-vm will open.
The training-vm is installing some software in the background. In the next step, you verify that setup is complete by checking the contents of the new directory.
To list the contents of the directory named training, run the following command:
The VM is ready for you to continue when the output of the ls
command yields the following result:
If the three scripts are not listed, wait a few minutes and try again.
This script sets the $DEVSHELL_PROJECT_ID
and $BUCKET
environment variables so that you do not have to manually set these variables for Project ID and Cloud Storage bucket name.
A Cloud Storage bucket was created for you during the initialization of lab resources.
This script reads sample data from a CSV file and publishes it to Pub/Sub. This script will send one hour of data in one minute.
Let the script continue to run in the current terminal, and continue with the next tasks.
Click Check my progress to verify the objective.
In this task, you open a second SSH terminal on training_vm and run commands to launch a Dataflow job to write streaming data from Pub/Sub into Bigtable.
A second terminal window will open. This new terminal session will not have the required environment variables. In the next step, you set these variables on the new terminal session.
This script sets the $DEVSHELL_PROJECT_ID
and $BUCKET
environment variables in the new terminal window.
Do not modify the code.
This script takes three required arguments to run a Dataflow job:
In the next steps, you use the --bigtable
option to direct the Dataflow pipeline to write data into Bigtable.
To exit nano, press CTRL+X.
To configure the run_oncloud.sh
script to use the project's default region, execute the following command:
When the pipeline has been launched successfully, you will see a message similar to the following:
In the Google Cloud console, on the Navigation menu, under Analytics, click Dataflow > Jobs.
Click on the new pipeline job name.
Locate the write:cbt step in the pipeline graph, and to see the details of the writer, click on the down arrow next to write:cbt.
Click on the provided writer, and review the details provided within Step info.
Click Check my progress to verify the objective.
In a previous task, you already configured the .cbtrc
configuration file in Cloud Shell. You can now run a simple cbt
CLI command to query the first five records of the table.
The output is structured as follows:
The output values will resemble the following:
In this final task, you stop the streaming data job and delete the Bigtable instance and table using commands.
In the Google Cloud console, on the Navigation menu, click Dataflow > Jobs.
Click on the pipeline job name.
Click Stop.
Select Cancel, and then click Stop job.
If prompted to confirm, type Y.
Click Check my progress to verify the objective.
In this lab, you used commands to create a new Bigtable instance and table, streamed data into the table using Dataflow, and confirmed that the data was successfully streaming into Bigtable by running simple cbt
CLI commands. You completed the lab by using commands to stop the job and delete the Bigtable table and instance.
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated December 27, 2024
Lab Last Tested December 27, 2024
Copyright 2025 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one