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
Recall & Review
beginner
What is a Preemptible VM in Google Cloud?
A Preemptible VM is a virtual machine that runs at a lower cost but can be stopped by Google Cloud at any time, usually within 24 hours. It's good for short, fault-tolerant tasks.
Click to reveal answer
intermediate
How does a Spot VM differ from a Preemptible VM?
Spot VMs are similar to Preemptible VMs but offer more flexible pricing and availability. They can be interrupted but may run longer and have different pricing models.
Click to reveal answer
beginner
Why would you choose a Preemptible or Spot VM over a regular VM?
Because they cost less, making them ideal for batch jobs, testing, or workloads that can handle interruptions without losing important data.
Click to reveal answer
intermediate
What happens to your data when a Preemptible VM is stopped?
The VM is stopped without warning, and any data stored on the VM's local disk is lost. Persistent disks keep data safe.
Click to reveal answer
advanced
How can you design your application to handle Preemptible VM interruptions?
Use checkpointing, save important data to persistent storage, and design your app to restart or continue work after interruptions.
Click to reveal answer
What is the maximum runtime for a Preemptible VM before it is stopped by Google Cloud?
A12 hours
B24 hours
C48 hours
DNo limit
✗ Incorrect
Preemptible VMs can run up to 24 hours before Google Cloud stops them.
Which of the following is a key benefit of using Spot VMs?
ALower cost with flexible availability
BGuaranteed uptime
CUnlimited runtime
DNo interruptions
✗ Incorrect
Spot VMs offer lower cost but can be interrupted, with flexible availability.
What should you use to keep data safe when using Preemptible VMs?
APersistent disks
BLocal VM disk
CTemporary storage
DNo storage needed
✗ Incorrect
Persistent disks keep data safe even if the VM is stopped.
Which workload is best suited for Preemptible or Spot VMs?
ACritical database servers
BReal-time user-facing apps
CBatch processing jobs
DLong-running backend services
✗ Incorrect
Batch jobs can handle interruptions and benefit from lower costs.
What is a common strategy to handle VM interruptions?
ARunning only on regular VMs
BIgnoring interruptions
CUsing only local storage
DCheckpointing and saving state
✗ Incorrect
Checkpointing helps resume work after interruptions.
Explain what Preemptible and Spot VMs are and when to use them.
Think about cheaper VMs that can be stopped anytime.
You got /5 concepts.
Describe how to design an application to work well with Preemptible or Spot VMs.
Focus on fault tolerance and data safety.
You got /4 concepts.
Practice
(1/5)
1. What is the main advantage of using Preemptible or Spot VMs in Google Cloud?
easy
A. They offer unlimited storage capacity
B. They provide guaranteed uptime for critical applications
C. They cost less but can be stopped at any time
D. They automatically scale without user input
Solution
Step 1: Understand the cost and availability trade-off
Preemptible and Spot VMs are cheaper because Google can stop them anytime to reclaim resources.
Step 2: Identify the main benefit
The main benefit is cost savings with the risk of interruption, not guaranteed uptime or unlimited storage.
Final Answer:
They cost less but can be stopped at any time -> Option C
Quick Check:
Cost savings with interruptions = D [OK]
Hint: Cheaper VMs can be stopped anytime, so cost saving is main benefit [OK]
Common Mistakes:
Thinking they guarantee uptime
Assuming they scale automatically
Confusing with storage features
2. Which of the following is the correct way to specify a Spot VM in a Google Cloud VM creation command?
easy
A. gcloud compute instances create my-vm --spot
B. gcloud compute instances create my-vm --interruptible
C. gcloud compute instances create my-vm --preemptible
D. gcloud compute instances create my-vm --ephemeral
Solution
Step 1: Recall the flag for Spot VMs
Spot VMs use the flag --spot in the gcloud command.
Step 2: Differentiate from Preemptible flag
--preemptible is for older Preemptible VMs, --spot is the newer recommended option.
Final Answer:
gcloud compute instances create my-vm --spot -> Option A
Quick Check:
Spot VM flag = --spot [OK]
Hint: Spot VMs use --spot flag, not --preemptible [OK]
Common Mistakes:
Using --preemptible for Spot VMs
Confusing --interruptible as a flag
Using unrelated flags like --ephemeral
3. Consider this snippet of a VM creation command: gcloud compute instances create test-vm --zone=us-central1-a --spot --machine-type=e2-medium What will happen if Google Cloud needs the resources back?
medium
A. The VM will automatically migrate to another zone
B. The VM will continue running without interruption
C. The VM will be stopped immediately without warning
D. The VM will receive a 30-second warning before stopping
Solution
Step 1: Understand Spot VM behavior on resource reclamation
Spot VMs are interruptible but Google Cloud sends a 30-second warning before stopping them.
Step 2: Eliminate other options
Immediate stop without warning is incorrect; automatic migration does not happen for Spot VMs; uninterrupted running contradicts the interruptible nature.
Final Answer:
The VM will receive a 30-second warning before stopping -> Option D
Quick Check:
Spot VMs get 30-second warning before stop = A [OK]
Hint: Spot VMs get 30-second warning before stopping [OK]
Common Mistakes:
Assuming immediate stop without warning
Thinking Spot VMs migrate automatically
Believing Spot VMs never stop
4. You created a VM with the command: gcloud compute instances create my-vm --preemptible --zone=us-east1-b But you want to switch to Spot VM instead. What is the correct fix?
medium
A. Add --spot flag without removing --preemptible
B. Replace --preemptible with --spot in the command
C. Change the zone to a Spot-only zone
D. Use --interruptible flag instead of --preemptible
Solution
Step 1: Identify the correct flag for Spot VMs
Spot VMs require the --spot flag, not --preemptible.
Step 2: Correct the command by replacing flags
Remove --preemptible and add --spot to switch VM type.
Final Answer:
Replace --preemptible with --spot in the command -> Option B
Quick Check:
Switching VM type requires flag replacement = B [OK]
Hint: Remove --preemptible, add --spot to switch VM type [OK]
Common Mistakes:
Adding --spot without removing --preemptible
Changing zone expecting Spot-only zones
Using non-existent --interruptible flag
5. You want to run a batch job that can tolerate interruptions and save costs. Which approach best uses Spot VMs to handle sudden stops and restarts?
hard
A. Design the job to save progress frequently and restart automatically on VM preemption
B. Use Spot VMs without any checkpointing or restart logic
C. Run the job on standard VMs to avoid interruptions
D. Use Spot VMs but disable automatic restarts
Solution
Step 1: Understand Spot VM interruption nature
Spot VMs can stop anytime, so jobs must handle interruptions gracefully.