Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit

Permalink
Merge pull request #45 from CLASS/gcp-dev
Browse files Browse the repository at this point in the history
GCP Updates
  • Loading branch information
amanda-tan authored Oct 18, 2022
2 parents 34301c5 + 715b0ca commit 04d496e
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 46 deletions.
38 changes: 34 additions & 4 deletions Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,26 @@ git config user.name
git config user.email
```

## GCP
## Google Cloud

Checkout the project so it is not seen by the students. Run `./scripts/gcp-cloudshell.sh` to open the shell with the agent and ports 8080 and 8081 forwarded and run the following commands (onetime setup). Be sure to check the project and account values.
Google Cloud development is split between the Cloud Shell episodes (04_intro_to_cli and 05_cli_storage) and the VM episodes. Although the Cloud Shell episodes *should* work on the VM the prompt responses are slightly different.

The Jupyter notebook is forwarded to http://localhost:8080 and the preview on http://localhost:8081. Use the links in the output of the script for Jupyter to login with the proper authentication key.

First setup the Google Cloud SDK and login to the account and project that you are going to use for development.

Verify the active project and account with
```bash
gcloud config configurations list
```

### Google Cloud Shell Development

The project is located in a hidden directory (`.essentials`) to hide the output from Jupyter and the students. To start Cloud Shell run `./scripts/gcp-cloudshell.sh` to open the shell with the agent and ports 8081 and 8080 forwarded (Jupyter and preview respectively) and run the following commands to setup the Cloud Shell (this needs to be done only once). Be sure to check the project and account values.

```bash
git clone git@github.internet2.edu:/CLASS/CLASS-Essentials.git .essentials
cd .essentials/
git checkout -b gcp-dev --track origin/gcp-dev
( cd .essentials/ ; git checkout -b gcp-dev --track origin/gcp-dev )

ACCOUNT=learner@class.internet2.edu
PROJECT=essentials-learner
Expand All @@ -66,6 +78,17 @@ Then run the following from your local machine (Make sure to shutdown from the w
```bash
./scripts/gcp-cloudshell-jupyter-lab.sh
```

### Google Virtual Machine Development

If you manually create a with the instructions in the 06_running_analysis episode you must use the `us-west2-c` zone or delete it and let the script create it.

Workflow
* Create and configure a new VM with `./scripts/gcp-create.sh`
* Open Jupiter link shown in the output of the `gcp-create.sh` script.
* Delete the vm when done (don't forget to commit and push!) with `./scripts/gcp-delete.sh`


## AWS

Expect that `aws` is installed locally. A ssh-key named 'learner' is required to access the account.
Expand All @@ -74,6 +97,13 @@ Expect that `aws` is installed locally. A ssh-key named 'learner' is required t

Expect that `az` is installed and configured locally. It will utilize your ~/.ssh/id_rsa.pub key.

## Jupyter Book Tags

You can control the rendering of the book by adding "Tags" to the cells. To access tags select a cell then click the gears box on the top right of the browser tab to open up the properties.

Tags
* To hide a cell add the tag `remove-cell`.

## Bugs and Fixes

The bash kernel and Python do not like the new "bracketed paste" mode of the new bash/readline. To fix you can disable "bracketed paste" mode by doing
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Best Practices:
# Maintainers
[John Hicks](jhicks@internet2.edu)

[Tim Middlekoop](tmiddelkoop@internet2.edu)
[Timothy Middelkoop](tmiddelkoop@internet2.edu)

[Ananya Ravipati](aravipati@internet2.edu)

Expand Down
29 changes: 16 additions & 13 deletions content/GCP/01_intro_to_cloud_console.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"tags": []
},
"source": [
"# Introduction to the GCP Cloud Console\n",
"# Introduction to the Google Cloud Console\n",
"\n",
":::{admonition} Overview\n",
":class: tip\n",
Expand Down Expand Up @@ -36,7 +36,7 @@
"source": [
"## The Who, Where, and What of the Cloud\n",
"\n",
"Before we get started we must first define, and find, a few key pieces of information about your environment that will be used throughout this lesson. This information is also important to ensure that this information is what you expect, otherwise you may use the wrong account or run or store things in the wrong place. It is important to be clear about these terms as they are often different in other cloud providers. We provide a [glossary of GCP terms](glossary.ipynb) for your reference."
"Before we get started we must first define, and find, a few key pieces of information about your environment that will be used throughout this lesson. This information is also important to ensure that this information is what you expect, otherwise you may use the wrong account or run or store things in the wrong place. It is important to be clear about these terms as they are often different in other cloud providers. We provide a [glossary of Google Cloud terms](glossary.ipynb) for your reference. Please note \"Google Cloud\" was formarly called \"GCP\"."
]
},
{
Expand All @@ -48,7 +48,7 @@
"source": [
"## Accounts (Authentication and Identity)\n",
"\n",
"The (Google) **Account** is the identity used to access the Google Cloud Platform web console and is in the form of an email address and is associated with an individual (the *who* is *you*!). This is typically the account you use to access Google services associated with your institution and not your personal account. This is the \"Who\" of the cloud. We will now login to the Google Cloud Platform web console and verify our account.\n",
"The (Google) **Account** is the identity used to access the Google Cloud web console and is in the form of an email address and is associated with an individual (the *who* is *you*!). This is typically the account you use to access Google services associated with your institution and not your personal account. This is the \"Who\" of the cloud. We will now login to the Google Cloud web console and verify our account.\n",
"\n",
" * Login to the web console with your (Google) Account by going to [https://console.cloud.google.com/](https://console.cloud.google.com/)\n",
" * Login with your credentials if you have not done so already.\n",
Expand Down Expand Up @@ -86,7 +86,7 @@
"source": [
"## Projects\n",
"\n",
"Almost everything you will do within Google Cloud Platform must be associated with a **Project**. This is the \"**Where**\" of the cloud. You must have at least one Project and you can manage multiple Projects within a single (Google) Account. Always make sure you are working in the correct project!\n",
"Almost everything you will do within Google Cloud must be associated with a **Project**. This is the \"**Where**\" of the cloud. You must have at least one Project and you can manage multiple Projects within a single (Google) Account. Always make sure you are working in the correct project!\n",
"\n",
"To find more information and change project settings\n",
" * Click on the \"Settings and Utilities button (**kabob** on the top right - see below) and then click on \"Project Settings\"\n",
Expand All @@ -112,7 +112,7 @@
":class: exercise\n",
"\n",
"Take a few moments to ask yourself the following questions:\n",
" * What is the *name* of the Project you are currently using in the Google Cloud Platform web console?\n",
" * What is the *name* of the Project you are currently using in the Google Cloud web console?\n",
" * What is the *Project ID* of that project?\n",
" * What is the *Project Number* of that project?\n",
" * Do you have multiple projects?\n",
Expand All @@ -132,13 +132,14 @@
"source": [
"## Products\n",
"\n",
"**Products** are the various services offered on Google Cloud such as *Google Compute Engine* and *Cloud Storage*. Within each product you create **resources** that you can use, such virtual machines. The Navigation Menu (often called the **hamburger**) is used to navigate to the various products.\n",
"**Products** are the various services offered on Google Cloud such as *Google Compute Engine* and *Cloud Storage*. Within each product you create **resources** that you can use, such virtual machines. The **Navigation Menu** (often called the **hamburger**) is used to navigate to the various products.\n",
"\n",
"![hamburger-navigation](img/hamburger-navigation.png)\n",
"\n",
" * Click on a product to navigate the product page\n",
" * You can pin frequently used items on the top of this page by clicking on the pin icon. \n",
" * A product is accessed and controlled via an API and usually must be enabled (once per project). To enable a product API click on the \"ENABLE\" button shown below.\n",
" * You can **pin** frequently used items on the top of this page by clicking on the pin icon.\n",
" * You can also navigate to products using the **\"MORE PRODUCTS\"** and **\"View All Products\"** buttons.\n",
" * A product is accessed and controlled via an API and usually must be enabled (once per project). To enable a product API click on the **\"ENABLE\"** button shown below.\n",
" * Click the hamburger again to hide the Left Sidebar.\n",
"\n",
"![enable-compute-api](img/enable-compute-api.png)\n",
Expand All @@ -159,9 +160,11 @@
":class: exercise\n",
"\n",
"Take a few moments to navigate to a few key products and enable them.\n",
" * Navigate to \"Cloud Storage\" under the \"Storage\" product group.\n",
" * You may need to \"Enable\" this product first by clicking on the \"Enable\" button on the \"Cloud Storage API\" page. This will only need to be done once per project.\n",
" * Navigate to the \"Compute Engine\" product under the \"Compute\" product group and enable the product as well.\n",
" * Navigate to \"Compute Engine\" under the \"Compute\" product group.\n",
" * You may need to expand the \"MORE PRODUCTS\" section by clicking on the down arrow. \n",
" * You may need to \"Enable\" this product first by clicking on the \"ENABLE\" button on the \"Compute Engine API\" page. This will only need to be done once per project.\n",
" * Navigate to the \"Cloud Storage\" product under the \"Storage\" product group and enable the product if needed.\n",
" * Navigate to the \"Compute Engine\" and \"Cloud Storage\" products using the \"All products\" page using the \"View All Products\" button under the Navigation menu (Hamburger).\n",
"\n",
":::"
]
Expand All @@ -175,13 +178,13 @@
"source": [
"## Everything Else\n",
"\n",
"If you did not already notice, every page on the GCP web console has a blue navigation bar at the top of the page. This can be used to quickly navigate to the page you need.\n",
"If you did not already notice, every page on the Google Cloud web console has a blue navigation bar at the top of the page. This can be used to quickly navigate to the page you need.\n",
"\n",
"![blue-bar](img/blue-bar.png)\n",
"\n",
"From left to right of the blue top navigation bar we have the following items (hover over the item with your mouse to see the name):\n",
" 1. Navigation Menu (often called the hamburger) allows you to go to each project and services page (shown below).\n",
" 2. Welcome (\"Google Cloud Platform\") provides an overview of your project.\n",
" 2. Welcome (\"Google Cloud\") provides an overview of your project.\n",
" * Click \"Dashboard\" it and note resources, billing, and platform Status\n",
" * This page is customizable and may look different.\n",
" 3. Project selection button showing the current project name with a drop-down arrow.\n",
Expand Down
8 changes: 4 additions & 4 deletions content/GCP/02_intro_to_compute.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
" * In the **Machine configuration** section:\n",
" * For **Series** select *E2* (default). The other options are for types of machines.\n",
" * For **Machine type** select *e2-medium* (default). Note that it shows the size of the VM in parentheses. \n",
" * In the **Identity and API access** section note that for the **Service Accounts** -> **Service account** option that the **Compute Engine default service account** is selected. This allows the *VM Instance* to access resources in the project. Note: the *\"Allow full access to all Cloud APIs\"* allows *everyone* on the VM to *access and edit all resources in the project*.\n",
" * In the **Identity and API access** section note that for the **Service Accounts** -> **Service account** option that the **Compute Engine default service account** is selected. This allows the *VM Instance* to access resources in the project. Leave the *\"Access scopes\"* on the default *\"Allow default access\"*. Note: the *\"Allow full access to all Cloud APIs\"* allows *everyone* on the VM to *access and edit all resources in the project*.\n",
" * Leave the remaining options as default.\n",
" * Note the **Monthly estimate** in the right side panel. This is only for running the *VM instance* and does not include other storage, networking, compute, and other charges that may occur by running software. Click **Details** show a breakdown of the *VM instance* only costs.\n",
"![compute-create-instance](img/compute-create-instance.png) "
Expand Down Expand Up @@ -145,10 +145,10 @@
"\n",
"To view the project activity we do the following:\n",
"\n",
" * Navigate to the project **Dashboard** by clicking on \"Google Cloud Platform\" on the left side of the top blue bar and clicking the \"*Dashboard*\" link.\n",
" * Navigate to the project **Dashboard** by clicking on \"Google Cloud\" on the left side of the top blue bar and clicking the \"*Dashboard*\" link.\n",
" * Select **Activity** tab just below the top blue bar.\n",
" * Look for the row with **Create VM** on the top of the table. This shows that the *VM Instance* was created.\n",
" * Expand the detail by clicking the **down arrow** on the right side of the row. You can see what identity created the bucket and the name. The rest of the information details the initial settings that you configured when creating the virtual machine. The details are not really important at this time, just know they exist.\n",
" * Expand the detail by clicking the **down arrow** on the right side of the row. You can see what identity created the VM and the name. The rest of the information details the initial settings that you configured when creating the virtual machine. The details are not really important at this time, just know they exist.\n",
" * By default, this information cannot be deleted for security and auditing reasons.\n",
"\n",
"Note: that the activity is on the project, not on your account.\n"
Expand Down Expand Up @@ -239,7 +239,7 @@
"```\n",
"Did you mean zone [us-central1-a] for instance: [essentials-test-1] (Y/n)? n\n",
"```\n",
"Answer \"n\".\n",
"**Answer \"n\"**.\n",
"\n",
"The command will now configure the instance to allow your ssh key and connect to it.\n",
"\n",
Expand Down
Loading

0 comments on commit 04d496e

Please sign in to comment.