Istruzioni e requisiti di configurazione del lab
Proteggi il tuo account e i tuoi progressi. Per eseguire questo lab, utilizza sempre una finestra del browser privata e le credenziali del lab.

Use Apache Beam and Bigtable to Enrich esports DLC Data

Lab 1 ora 30 minuti universal_currency_alt 1 credito show_chart Introduttivi
info Questo lab potrebbe incorporare strumenti di AI a supporto del tuo apprendimento.
Questi contenuti non sono ancora ottimizzati per i dispositivi mobili.
Per un'esperienza ottimale, visualizza il sito su un computer utilizzando un link inviato via email.

GSP1345

Google Cloud self-paced labs logo

Overview

Imagine you are a data engineer for Cymbal Gaming. You and the development team are building a new e-sports game, "Galactic Grand Prix." The game produces real-time data based on heads-up games between two players from different teams. For example, two players compete in an event, a winner is determined, and points are awarded to the winning player and team. You are tasked with creating recommendations for DLC purchase data. If a player purchases DLC for their character in Galactic Grand Prix, you will offer them other items based on what other competitors are purchasing.

You have read about Pub/Sub and know that it can be used with streaming data in Google Cloud. You have also read about Dataflow (Google Cloud's managed Apache Beam service), and Bigtable a NoSQL database on Google Cloud. You suspect that these services can be used with a Jupyter notebook to build a solution to offer other DLC items to customers based on purchases, but you are not sure where to start.

When you start the lab, the environment will contain the resources that are shown in the following diagram.

By the end of the lab, you will have used the architecture to perform several tasks.

The following table provides a detailed explanation of each task in relation to the lab architecture.

Numbered Task Detail
1. Create Google Cloud resources: In this task, you create the Pub/Sub topic and subscription, and Bigtable instance. You will create the table later in the notebook.
2. Open the notebook in Vertex AI Workbench and choose kernel.
3. Install packages and configure the notebook for your project:
You will use the various Python libraries with this lab, including PyTorch (as the model for tensors), and Apache Beam (to support Dataflow integration). These libraries will be installed once your lab is provisioned and you will reference them in the Jupyter notebook throughout the lab. You also need to configure the notebook to have access to resources in your project, like the Cloud Storage bucket provided to you at lab launch.
4. Train the model:
In this task, you will train the PyTorch model with Galactic Grand Prix player purchase data for DLC products, as tensors.
5. Configure the Bigtable table and publish messages to Pub/Sub:
In this task you configure the Bigtable table within your instance, and publish messages to your Pub/Sub subscription.
6. Use the Bigtable enrichment handler and transform:
In this task you will use the Bigtable enrichment handler and transform.
7. Run inference and the pipeline:
In this task, you will use the PyTorchModelHandlerTensor interface to run inference and then run the pipeline.

Objectives

In this lab, you will:

  • Train a PyTorch model with purchase data, represented as tensors.
  • Enrich new purchases from Pub/Sub with demographic data.
  • Recommend products to new customers using a Dataflow Pipeline.

Setup and requirements

Before you click the Start Lab button

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 are made available to you.

This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito (recommended) or private browser window to run this lab. This prevents conflicts between your personal account and the student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab—remember, once you start, you cannot pause a lab.
Note: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.

How to start your lab and sign in to the Google Cloud console

  1. Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:

    • The Open Google Cloud console button
    • Time remaining
    • The temporary credentials that you must use for this lab
    • Other information, if needed, to step through this lab
  2. 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.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab Details pane.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab Details pane.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To access Google Cloud products and services, click the Navigation menu or type the service or product name in the Search field. Navigation menu icon and Search field

Task 1: Create the Google Cloud resources

In this task, you create the Google Cloud resources that support the lab, including the Pub/Sub Topic and subscription and Bigtable instance. Note: you will be using Cloud Shell commands to create these resources to expedite the process.

To use gcloud CLI commands effectively, first access Google Cloud Shell and set environment variables.

Access Cloud Shell and set environment variables.

  1. Open Cloud Shell, by clicking Activate Cloud Shell.

  2. You need to authorize its use, as this is the first time you use Cloud Shell in this lab. To do this, click Continue and then Authorize in the pop-up window.

  3. Run the following commands.

    export PROJECT_ID="{{{project_0.project_id|set at lab start}}}"
  4. Run the commands below to confirm the variables are stored.

    echo ${PROJECT_ID}

    You will use these variables later in the lab.

Create the Bigtable instance

  1. Run the following command to create the Bigtable instance.

    gcloud bigtable instances create instance \ --display-name="My Bigtable Instance" \ --cluster-config=id=my-cluster,zone={{{project_0.default_zone | Zone}}},nodes=1

    You should see a confirmation message indicating the instance was created.

    Note: You will create the Bigtable table later within your Jupyter notebook.

Create the Pub/Sub topic and subscription

  1. Run the following command to create the Pub/Sub topic.

    gcloud pubsub topics create customer-data

    You should see a confirmation message indicating the Pub/Sub topic was created.

  2. Run the following command to create the Pub/Sub subscription for your topic.

    gcloud pubsub subscriptions create customer-data_sub --topic=customer-data

    You should see a confirmation message indicating the subscription was added to the topic.

Click Check my progress to verify the objective. Create the Google Cloud resources.

Task 2. Open the notebook in Vertex AI Workbench and choose kernel

Task 2a. Open the notebook

  1. In the Google Cloud console, on the Navigation menu (Navigation menu icon), click Vertex AI > Workbench.

  2. Find the instance and click on the Open JupyterLab button.

The JupyterLab interface for your Workbench instance opens in a new browser tab.

Task 2b. Choose the kernel

  1. Open the file.

  2. In the Select Kernel dialog, choose Python 3 from the list of available kernels.

Task 3. Import Python packages and set environment variables

In this task, you import the necessary Python packages to use this notebook and set environment variables.

  1. Complete the steps in Task 3, Install packages, and configure the notebook section of the notebook.

    For Project ID, use , for instance_id, use instance, and for table_id use customer_data. Recall that you created the Bigtable instance in Task 1. Setting these values now will ensure you can successfully complete later tasks in this notebook and failure to do so may generate errors.

Click Check my progress to verify the objective. Install packages and configure the notebook.

Task 4. Train the model

In this task, you create the dataset and convert the data within it to tensors. You will then build the PyTorch model and train it with these tensors.

  1. Complete the Train the model section of the notebook.

Click Check my progress to verify the objective. Train the model.

Task 5. Configure the Bigtable table and publish messages to Pub/Sub

In this task, you will create and configure the Bigtable table with the column families, then load data to the table. You will also publish messages to Pub/Sub.

  1. Run through the Configure the Bigtable table and publish messages to Pub/Sub section of the notebook.

Click Check my progress to verify the objective. Configure the Bigtable table and publish messages to Pub/Sub.

Task 6. Use the Bigtable enrichment handler and transform

In this task, you will use the Bigtable enrichment handler, a specialized connector used within your Dataflow pipeline, that performs the enrichment process using Bigtable as the data source. You will also use the Bigtable enrichment transform. Think of the Bigtable enrichment handler as the tool and the transform as the verb that initiates it in your code.

  1. Run through the Use the Bigtable enrichment handler and transform section of the notebook.

Click Check my progress to verify the objective. Use the Bigtable enrichment handler and transform.

Task 7. Run inference and the pipeline

In this task, you will run inference with the PyTorch model and run the dataflow pipeline.

  1. Run through the Run inference and the pipeline section of the notebook.
Important: Once you get the three recommendations provided by the pipeline in the last cell, as noted in the notebook, the cell will continue running. You must manually stop it. If you do not stop the cell manually, the pipeline will automatically stop when the lab environment times out.

Click Check my progress to verify the objective. Run inference and the pipeline.

Congratulations!

In this lab, you learned how to train a PyTorch model with purchase data represented as tensors. You also learned how to enrich new purchases from Pub/Sub with demographic data and then recommend new DLC products to customers with your Dataflow pipeline.

Google Cloud training and certification

...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 January 22, 2026

Lab Last Tested January 22, 2026

Copyright 2026 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.

Prima di iniziare

  1. I lab creano un progetto e risorse Google Cloud per un periodo di tempo prestabilito
  2. I lab hanno un limite di tempo e non possono essere messi in pausa. Se termini il lab, dovrai ricominciare dall'inizio.
  3. In alto a sinistra dello schermo, fai clic su Inizia il lab per iniziare

Utilizza la navigazione privata

  1. Copia il nome utente e la password forniti per il lab
  2. Fai clic su Apri console in modalità privata

Accedi alla console

  1. Accedi utilizzando le tue credenziali del lab. L'utilizzo di altre credenziali potrebbe causare errori oppure l'addebito di costi.
  2. Accetta i termini e salta la pagina di ripristino delle risorse
  3. Non fare clic su Termina lab a meno che tu non abbia terminato il lab o non voglia riavviarlo, perché il tuo lavoro verrà eliminato e il progetto verrà rimosso

Questi contenuti non sono al momento disponibili

Ti invieremo una notifica via email quando sarà disponibile

Bene.

Ti contatteremo via email non appena sarà disponibile

Un lab alla volta

Conferma per terminare tutti i lab esistenti e iniziare questo

Utilizza la navigazione privata per eseguire il lab

Il modo migliore per eseguire questo lab è utilizzare una finestra del browser in incognito o privata. Ciò evita eventuali conflitti tra il tuo account personale e l'account studente, che potrebbero causare addebiti aggiuntivi sul tuo account personale.