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
Creating a VM instance
📖 Scenario: You are setting up a simple virtual machine (VM) instance on Google Cloud Platform (GCP) to host a small website. This VM will run a basic Linux operating system.
🎯 Goal: Create a VM instance on GCP with a specific name, machine type, and image. Configure it to allow HTTP traffic.
📋 What You'll Learn
Create a VM instance named my-vm-instance
Use the machine type e2-micro
Use the image family debian-11 from the debian-cloud project
Allow HTTP traffic to the VM
💡 Why This Matters
🌍 Real World
Creating VM instances is a common task when deploying applications or websites on cloud platforms like GCP.
💼 Career
Cloud engineers and developers often need to configure and launch VM instances with specific settings to meet application requirements.
Progress0 / 4 steps
1
Define the VM instance name
Create a variable called instance_name and set it to the string "my-vm-instance".
GCP
Hint
Use a simple string assignment to create the variable.
2
Set the machine type
Create a variable called machine_type and set it to the string "e2-micro".
GCP
Hint
Assign the machine type as a string to the variable.
3
Specify the image family and project
Create two variables: image_family set to "debian-11" and image_project set to "debian-cloud".
GCP
Hint
Define both variables with the exact string values.
4
Create the VM instance configuration dictionary
Create a dictionary called vm_config with keys and values: "name" set to instance_name, "machineType" set to machine_type, "imageFamily" set to image_family, "imageProject" set to image_project, and "allowHttp" set to True.
GCP
Hint
Use a dictionary with the exact keys and link the values to the variables you created.
Practice
(1/5)
1. What does creating a VM instance in Google Cloud allow you to do?
easy
A. Create a database
B. Store files permanently
C. Run a virtual computer in the cloud
D. Send emails automatically
Solution
Step 1: Understand VM instance purpose
A VM instance is a virtual machine, like a computer inside the cloud.
Step 2: Identify correct function
Running a virtual computer matches the VM instance role, unlike storing files or sending emails.
Final Answer:
Run a virtual computer in the cloud -> Option C
Quick Check:
VM instance = virtual computer [OK]
Hint: VM means virtual machine, a computer in the cloud [OK]
Common Mistakes:
Confusing VM with storage service
Thinking VM creates databases directly
Assuming VM sends emails automatically
2. Which command correctly creates a VM instance named my-vm in zone us-central1-a with machine type e2-medium and image debian-11?
easy
A. gcloud create vm my-vm --zone us-central1-a --type e2-medium --image debian-11
B. gcloud compute vm create my-vm --zone=us-central1-a --machine-type=e2-medium --image debian-11
The command failed with an error about the image. What is the likely cause?
medium
A. The image name 'debian-10' is incorrect or deprecated
B. The zone 'us-west1-c' does not exist
C. The machine type 'e2-small' is invalid
D. You forgot to specify the project
Solution
Step 1: Check image parameter validity
Using '--image=debian-10' is often invalid because images require full name or image family with project.
Step 2: Understand error cause
Image errors usually mean the image name is wrong or deprecated, not zone or machine type.
Final Answer:
The image name 'debian-10' is incorrect or deprecated -> Option A
Quick Check:
Image errors = wrong image name [OK]
Hint: Use image family and project, not just image name [OK]
Common Mistakes:
Assuming zone or machine type caused image error
Not specifying image project with image family
Using outdated image names
5. You want to create a VM instance that automatically allows HTTP traffic and uses a custom startup script to install software. Which command correctly achieves this?