Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Boot Disk Images Setup on Google Cloud Platform
📖 Scenario: You are setting up virtual machines on Google Cloud Platform (GCP) for a small project. Each VM needs a boot disk image to start the operating system. You will create a list of boot disk images, configure a filter to select specific images, and then prepare the final configuration for VM creation.
🎯 Goal: Build a configuration that lists boot disk images, filters them by family, and prepares the final disk configuration for VM instances.
📋 What You'll Learn
Create a dictionary named boot_disk_images with exact image families and their project names.
Add a variable named selected_family to filter images by family.
Use a dictionary comprehension to create filtered_images containing only images matching selected_family.
Create a final dictionary named vm_disk_config that includes the filtered images and sets the disk type to pd-standard.
💡 Why This Matters
🌍 Real World
Setting up boot disk images is essential when creating virtual machines on cloud platforms like GCP. It ensures the VM boots with the correct operating system.
💼 Career
Cloud engineers and infrastructure specialists often configure boot disks for VMs to automate deployments and maintain consistent environments.
Progress0 / 4 steps
1
Create the boot disk images dictionary
Create a dictionary called boot_disk_images with these exact entries: 'debian-11': 'debian-cloud', 'ubuntu-2204-lts': 'ubuntu-os-cloud', 'windows-2019': 'windows-cloud'.
GCP
Hint
Use curly braces to create a dictionary with keys as image families and values as project names.
2
Add the selected_family variable
Add a variable called selected_family and set it to the string 'ubuntu-2204-lts'.
GCP
Hint
Assign the exact string to the variable selected_family.
3
Filter images by selected_family
Use a dictionary comprehension to create a dictionary called filtered_images that includes only the entry from boot_disk_images where the key matches selected_family.
GCP
Hint
Use for family, project in boot_disk_images.items() and filter with if family == selected_family.
4
Create the final VM disk configuration
Create a dictionary called vm_disk_config with two keys: 'images' set to filtered_images and 'disk_type' set to the string 'pd-standard'.
GCP
Hint
Use curly braces to create a dictionary with the specified keys and values.
Practice
(1/5)
1. What is the main purpose of a boot disk image in Google Cloud Platform (GCP)?
easy
A. It stores user data separately from the VM.
B. It provides the operating system for a virtual machine (VM).
C. It manages network traffic for the VM.
D. It controls billing and usage reports.
Solution
Step 1: Understand the role of boot disk images
Boot disk images contain the operating system that a VM uses to start and run.
Step 2: Identify the correct function in GCP context
In GCP, the boot disk image is the source of the OS for the VM instance.
Final Answer:
It provides the operating system for a virtual machine (VM). -> Option B
Quick Check:
Boot disk image = OS provider [OK]
Hint: Boot disk image = OS for VM startup [OK]
Common Mistakes:
Confusing boot disk image with data disk
Thinking it manages network or billing
Assuming it stores user files
2. Which of the following is the correct command to list all available public boot disk images in GCP using gcloud CLI?
easy
A. gcloud compute images list --project=debian-cloud
B. gcloud compute instances list --images
C. gcloud compute disks list --public
D. gcloud compute images list --public
Solution
Step 1: Recall the correct gcloud command for listing images
The command to list images uses 'gcloud compute images list' with a project filter for public images.
Step 2: Identify the public image project
Public images like Debian are under projects such as 'debian-cloud'. So filtering by --project=debian-cloud lists those images.
Final Answer:
gcloud compute images list --project=debian-cloud -> Option A
Quick Check:
List images by project = gcloud compute images list --project=debian-cloud [OK]
Hint: Use --project with public image project name [OK]
Common Mistakes:
Using --public flag which does not exist
Listing disks instead of images
Listing instances instead of images
3. Consider this snippet to create a VM with a boot disk image: