0
0
GCPcloud~30 mins

GCP Console walkthrough - Mini Project: Build & Apply

Choose your learning style9 modes available
GCP Console walkthrough
📖 Scenario: You are starting to learn how to use the Google Cloud Platform (GCP) Console. This is the web interface where you can create and manage cloud resources like virtual machines, storage, and databases.Imagine you want to organize your cloud projects and see the resources inside them.
🎯 Goal: Learn to navigate the GCP Console by creating a project list, selecting a project, and viewing its resources.
📋 What You'll Learn
Create a list of GCP projects with exact names and IDs
Add a variable to select a specific project by its ID
Write a function to list resources for the selected project
Add a final step to display the selected project and its resources
💡 Why This Matters
🌍 Real World
Cloud engineers often manage multiple projects in GCP and need to select and view resources per project using the console or scripts.
💼 Career
Understanding how to organize and access cloud projects and their resources is essential for cloud administrators and developers working with GCP.
Progress0 / 4 steps
1
Create a list of GCP projects
Create a variable called projects that is a list of dictionaries. Each dictionary must have the keys 'name' and 'project_id' with these exact entries: {'name': 'Project Alpha', 'project_id': 'alpha-123'}, {'name': 'Project Beta', 'project_id': 'beta-456'}, and {'name': 'Project Gamma', 'project_id': 'gamma-789'}.
GCP
Need a hint?

Use a list with three dictionaries. Each dictionary has keys 'name' and 'project_id' with the exact values given.

2
Select a project by its ID
Create a variable called selected_project_id and set it to the string 'beta-456' to select the project with that ID.
GCP
Need a hint?

Assign the string 'beta-456' to the variable named selected_project_id.

3
Write a function to list resources for the selected project
Write a function called list_resources that takes a parameter project_id and returns a list of resource names. For this exercise, return ['Compute Engine VM', 'Cloud Storage Bucket'] if project_id matches any project in projects. Otherwise, return an empty list.
GCP
Need a hint?

Loop through projects, check if project_id matches, then return the fixed list of resources.

4
Display the selected project and its resources
Create a variable called selected_project that finds the dictionary in projects where 'project_id' equals selected_project_id. Then create a variable called resources that calls list_resources with selected_project_id.
GCP
Need a hint?

Loop through projects to find the one with matching project_id and assign it to selected_project. Then call list_resources with selected_project_id.