GCP Environment
The user account provisioned through the Katacoda environment will have access to an isolated project per user, defined under O’Reilly’s organization. Note that the temporary user account is active for 60 minutes and is then deactivated. Please see the GCP Sandbox example (through direct link only) on learning.oreilly.com.
Lab Set-up
- Base imageID to configure in index.json:
"imageid": "orm-gcp"
- index.json should be configured to auto-execute the set-env.sh script.
"intro": {
"text": "intro.md",
"courseData": "background.sh",
"code": "set-env.sh"
},
- The set-env.sh script should include:
chmod +x /opt/get-gcp
for i in {1..20}; do /opt/get-gcp && . ~/.gcpenv && break || sleep 1; done
The user is assigned a combination of roles (roles/editor
, roles/iam.serviceAccountAdmin
, roles/resourcemanager.projectIamAdmin
, roles/datastore.owner
, and roles/servicenetworking.networksAdmin
) for their associated project. These roles are necessary for the user to create and manage resources in the project, but prevent the user from creating or modifying resources outside of the project.
Pre-Installed Tools
- gcloud CLI is pre-installed in the base image.
- Terraform
Environment Variables
The environment includes GCP credentials in the file ~/.gcp-resp
, and there is a helper script /opt/get-gcp
that configures the following environment variables:
- console_url: URL containing project ID to sign in to a GCP account as a user
- email: GCP user email
- password: GCP user password
- project_name: GCP project name
- GOOGLE_APPLICATION_CREDENTIALS: path to the service account key file
- GOOGLE_CLOUD_PROJECT: GCP project ID
- USER: GCP project name
- randomNum / sessionRandomNumber: a random string of 12 decimal digits. Useful for resources that need to be globally unique.
Services
For full service details on Supported Services, Quotas, and Limitations, please refer to the GCP Service Details page.