0
0
GCPcloud~15 mins

Why Compute Engine provides VM flexibility in GCP - See It in Action

Choose your learning style9 modes available
Why Compute Engine Provides VM Flexibility
📖 Scenario: You are learning about Google Cloud's Compute Engine and how it allows you to create virtual machines (VMs) that fit your exact needs.Imagine you want to set up a VM for a small website, but later you might need a bigger VM for more users. Compute Engine lets you choose the right size and change it anytime.
🎯 Goal: Build a simple Python dictionary that represents VM configurations showing how Compute Engine provides flexibility by allowing different CPU and memory options.
📋 What You'll Learn
Create a dictionary with VM types and their CPU and memory specs
Add a variable to select a VM type
Use a loop to display the selected VM's specs
Add a final statement that confirms the VM configuration
💡 Why This Matters
🌍 Real World
Cloud engineers often need to choose VM sizes that fit their workload needs without wasting resources. Understanding VM flexibility helps optimize cost and performance.
💼 Career
Knowing how to configure and select VM types is essential for roles like cloud administrator, cloud architect, and DevOps engineer.
Progress0 / 4 steps
1
Create VM configurations dictionary
Create a dictionary called vm_configs with these exact entries: 'small': {'cpu': 1, 'memory': 3.75}, 'medium': {'cpu': 2, 'memory': 7.5}, and 'large': {'cpu': 4, 'memory': 15} representing CPU cores and memory in GB.
GCP
Need a hint?

Use curly braces to create a dictionary. Each key is a VM type string, and each value is another dictionary with keys 'cpu' and 'memory'.

2
Select a VM type
Create a variable called selected_vm and set it to the string 'medium' to choose the medium VM configuration.
GCP
Need a hint?

Assign the string 'medium' to the variable selected_vm.

3
Display selected VM specs
Use a for loop with variables spec and value to iterate over vm_configs[selected_vm].items() and assign the specs to variables cpu_cores and memory_gb accordingly.
GCP
Need a hint?

Loop over the items of the selected VM's specs dictionary. Use an if-else to assign cpu_cores and memory_gb.

4
Confirm VM configuration
Create a variable called vm_summary and set it to a string that says exactly: "Selected VM 'medium' has 2 CPU cores and 7.5 GB memory."
GCP
Need a hint?

Assign the exact string to vm_summary using double quotes and single quotes as shown.