Skip to content

Latest commit

 

History

History
89 lines (58 loc) · 4.03 KB

File metadata and controls

89 lines (58 loc) · 4.03 KB

Lab 12

Goal

Get experience configuring a cloud environment


  • You'll be pairing with your Lab partner.
  • You'll be making setting things up using Terraform (console), checking them in the Console (pointing and clicking).
  • There are a lot of things that can go wrong. No stress, this is a learning experience.
  • Take your time. It's preferred that you read outputs carefully, understand what's going on, and explore, rather than rushing through.

Part 1: Terraform

Work through the Terraform Google Cloud tutorial, pairing in your Lab groups.

  • When it asks you to create a Google Cloud Project, do so with the following settings:
    • Project name: Something like <user1>-<user2>-lab-12
    • Organization: afeld.me
    • Location: SIPA Advanced Computing -> Spring 2026

Part 2: IAM for services

We're going to deploy a Cloud Run Function that lists our BigQuery datasets. You can do this part through the Console.


BigQuery setup

  1. Switch to the Project created above.
  2. Create a table in BigQuery using sample data from Lab 8 or any other CSV.

Set up the Hello World Cloud Run Function

  1. Create a Function using the "inline editor". Set the following, leave the other defaults.
    • Service name: lab-12
    • Region: us-central1
    • Runtime: Python 3.14
    • Uncheck Use Cloud IAM to authenticate incoming requests.
    • Under Container(s), Volumes, Networking, Security -> Security, set service account to be Default compute service account.
  2. It will give you some Hello World code. Click Save and redeploy.
  3. Deployment might take a few minutes. When it's done, try visiting the URL.
  4. View the Logs.
  5. Refresh the live URL a bunch of times.
  6. View the Metrics.
  7. Explain to each other what happened in this section.

Custom Function

  1. Edit source, and replace the code.
  2. Click Save and redeploy.
  3. Deployment might take a minute. When it's done, try visiting the URL. It should show an empty list ([]), as it doesn't have access to any BigQuery DataSets.
  4. Grant BigQuery Data Viewer to the default compute service account (<project-id>-compute@developer.gserviceaccount.com).
  5. Refresh the Function URL. You should see your dataset listed.
  6. Explain to each other what happened in this section.

Unlike when we set up Streamlit to talk to BigQuery, no key was needed. Things within Google Cloud (Functions, in this case) run as a service account, and roles can be granted to that.


Challenge

If you got done early, repeat the steps above using the Google Cloud provider using Terraform.


Delete the Project to avoid charges.


Nothing needs to be submitted for this Lab.