COMS E6111-Advanced Database Systems
Spring 2024

Google Cloud Setup

Setting Up your Google Cloud Account

This page provides instructions on how to set up a Linux virtual machine. We will be using Google's cloud computing infrastructure for the class projects. You should have received an email from Lara with your individual Google Cloud code that will provide you with enough credit for the class. This credit is for the full semester, and it should last for all three projects in the class.

Caution: Running services (e.g., virtual machines) on any cloud provider costs money or credits. It can be very easy to spend more than you anticipated by leaving your services running. So please make it a habit to stop your services when not in use. If you run out of credits, there's not much that the class staff can do to help you out.

Signing Up and Setting Up the OS

As a first step, please log in with your Lionmail account in your browser and follow link console.cloud.google.com/education. After visiting this website, confirm that you are logged in with your Lionmail account by checking the top right of your screen. (If you enter your credit code into the wrong account, such as your personal Gmail account, you won't be able to transfer it later to your Lionmail account.) After confirming that you are logged in with your Lionmail account, enter the credit code ("coupon code") that we sent you by email.

Then, to set up your VM on the Google Cloud, follow these steps in a new browser tab:

  1. Go to console.cloud.google.com
  2. Click on the left of the search bar, and then on “NEW PROJECT” (if you have the option to select from multiple billing accounts, make sure you select the one with “Billing Account for Education” as your billing account name)
  3. Enter a “Project name” (e.g., “cs6111”) and click “CREATE”
  4. Go back to console.cloud.google.com and make sure that the project that you just created (e.g., “cs6111”) is selected on the top navigation bar, to the right of “Google Cloud”
  5. Click on the menu button in the top left hand corner, select "More products," then select the item “Compute Engine” and then “VM instances”; if prompted, click on "Enable" and/or "Set account"; please be patient: this step takes a few moments to complete
  6. Click “CREATE INSTANCE” to create your instance (roughly speaking, an instance is a computer that runs on the cloud)
  7. Type any name (for example, “cs6111-instance”)
  8. Change “Region” to “us-east1 (South Carolina)”
  9. Change “Zone” to any “us-east1-x” (the last letter doesn’t matter) or, if you are far from New York right now, to a zone near you
  10. In the "Machine configuration" tile set "Series" to "N1" and "Machine type" to "n1-standard-1 (1 vCPU, 3.75 GB memory)"
  11. In the "Boot disk" tile, click on "Change"; then, in the new popup menu, select "Ubuntu" as "Operating system" and "Ubuntu 20.04 LTS (x86/64, amd64 focal image built on 2024-01-10)" as "Version"; finally, change the boot disk size to 25 GB in the "Size (GB)" field and click the “SELECT” button
  12. Now, you should be back on the “Create an Instance” page; scroll all the way down to the bottom of the page, and click the "Create" button; wait until the green checkmark shows up

When a VM is created, it is automatically started as well. So please make sure that you stop the VM (see below) if you don't need to use it, to avoid wasting credits.

Using your VM

Background information: Each VM falls under a project on Google Cloud. To start working, you should always make sure that you are under the project that you created above for this class (e.g., “cs6111”).

  1. Go to console.cloud.google.com
  2. Select the correct project for the class (e.g., “cs6111”) at the top of the page, next to “Google Cloud”
  3. Click on the menu button in the top left hand corner and select the item “Compute Engine” and then "VM instances"
  4. Select the VM that you created above for the project (e.g., “cs6111-instance”) by checking the box next to its name and, if it's not running already, select “Start” from the menu on the right (this process can take a minute)
  5. Once the VM has started up, there are two ways to connect:
    1. On the page where you start the VM, you can connect to the VM through the browser by clicking on “SSH” in the same row as the rest of the VM’s information. This opens a new browser window that you can interact with as you would with a Unix/Linux terminal.
    2. Alternatively, you can SSH into the VM by using the terminal, following the instructions available here.
  6. To turn off the VM when you are done using it, select the VM and click “Stop” on the “Compute Engine” page. Make sure you turn off the VM whenever you or your partner aren’t using it to avoid wasting credits.

Adding your Teammate to the VM

  1. Go to console.cloud.google.com
  2. Make sure that you are in the project that the VM is associated with (see above)
  3. Click on the menu button in the top left hand corner and, under "More Products," click on the entire menu item “IAM and Admin”
  4. Click the “Grant Access” button on the top middle of the page
  5. Type in your teammate’s Lionmail address in the box labeled “Add principals”
  6. Under “Assign Roles,” click the dropdown menu. Under “Quick Access,” go to “Currently Used” and then select the “Owner” option to the right, in order to give your teammate full access to the resources of the project. If your teammate does not receive an invite, your teammate can use the link that results from instantiating the following URL template to manually accept and activate the invitation:
    https://console.cloud.google.com/invitation?project=<your-project-id>&account=<the-account-email-invited>&memberEmail=<the-account-email-invited>
    You would need to fill in the information before using this link. The value for <your-project-id> can be found in Home/Dashboard, and <the-account-email-invited> should be your teammate's email address. Make sure you do not include the brackets in the URL template above.
  7. Once your teammate accepts the invitation, your teammate will be able to use the VM as specified in the previous instructions; to switch to a virtual environment dbproj on your VM, see instructions here for setting up your virtual environment; instead of just running python3 -m venv dbproj, run the following to create a Python 3.8 virtual environment:
    • sudo apt-get -y update
    • sudo apt install python3-venv
    • python3 -m venv dbproj
    Your teammate should then run:
    source /home/<your_uni>/dbproj/bin/activate
    Note that your teammate should explicitly specify your UNI in the path above ("<your_uni>") when your teammate activates your environment in your VM.

Installing Additional Software in Your VM

Before installing additional software, make sure to run:
sudo apt-get -y update

Then, install some software packages that we will need, using the Ubuntu package management tool apt-get. To install a package, type:
sudo apt-get install <packagename1 packagename2 ...>

Use this command to install packages that you might need, such as the following examples and any others that you require:

Run:
sudo apt-get install python3-pip
sudo apt install python3-testresources
pip3 install --upgrade google-api-python-client

Stopping Your Virtual Machine

While you have abundant credit for this class on Google Cloud, it is very easy to accidentally use up all of your credits. To conserve your credits—and also to avoid wasting energy—make sure to turn off your machine whenever you are not using it, following the instructions under "Using your VM" above.