Planning and implementing a cloud solution · Topic 1 of 9

Choosing Compute and Launching VMs

Choosing Compute Engine, GKE, Cloud Run, Cloud Run functions or Agent Runtime, launching VMs with availability policies and SSH keys, disks, and GPUs versus TPUs.

  • 5 min
  • Includes a diagram
In a nutshell
  • Compute Engine (control), GKE (Kubernetes), Cloud Run (serverless containers), Cloud Run functions (event code), Agent Runtime (AI agents).
  • Availability policy: on host maintenance MIGRATE or TERMINATE, automatic restart; GPU VMs must TERMINATE.
  • Prefer OS Login over metadata SSH keys.

What it is

Google Cloud offers several ways to run code, from virtual machines you manage to fully serverless services. The exam expects you to select the right compute option for a workload, launch a Compute Engine instance with the right settings, choose its disk type, and decide between GPUs and TPUs.

WorkloadNeed OS control?yesCompute EngineWorkloadContainers at scale?yesGKEWorkloadStateless container or HTTP service?yesCloud RunWorkloadSmall event handler?yesCloud Run functionsWorkloadAI agent?yesAgent Runtime

How it works

Choosing compute

Choosing compute: AI agents go to Agent Runtime; small event handlers to Cloud Run functions; workloads needing OS control or special software to Compute Engine; containers needing Kubernetes features to GKE; other containers to Cloud Run.

OptionBest forYou manage
Compute EngineExisting apps, custom OS or software, full control, specialized hardwareOS, patches, scaling setup
Google Kubernetes Engine (GKE)Containerized microservices needing Kubernetes features and portabilityWorkloads and some cluster settings (less in Autopilot)
Cloud RunStateless containers, web apps and APIs, jobs; scales to zeroContainer and settings only
Cloud Run functionsSmall single-purpose functions triggered by HTTP or eventsFunction code
Agent Runtime on Gemini Enterprise Agent Platform (formerly Vertex AI Agent Engine)Deploying, scaling and managing AI agents in productionAgent code

Launching an instance

gcloud compute instances create web-1 \
  --zone=us-central1-a --machine-type=e2-medium \
  --image-family=debian-12 --image-project=debian-cloud

Key settings at creation:

SettingOptions and meaning
Machine typePredefined families (general purpose E2, N2, N4; compute optimized C-series; memory optimized M-series; accelerator optimized A-series) or custom
Availability policyOn host maintenance: MIGRATE (live migrate, default for standard VMs) or TERMINATE; automatic restart on or off; Spot and preemptible VMs cannot live migrate
SSH keysUse OS Login (recommended, IAM-based) or metadata-managed SSH keys at project or instance level; gcloud compute ssh manages keys for you
Service account and scopesThe identity the VM uses to call Google APIs
Network tags and labelsTags target firewall rules; labels organize costs
Startup scriptRuns on boot, through metadata startup-script
Exam tip

VMs with GPUs cannot live migrate, so their on host maintenance policy must be TERMINATE.

Storage for Compute Engine

Disk optionCharacteristicsUse
Zonal Persistent DiskDurable network block storage in one zone; types such as balanced, SSD and standardMost boot and data disks
Regional Persistent DiskSynchronously replicated across two zones in a regionHigh availability: fail over a VM to the other zone with its data
Google Cloud HyperdiskNext-generation block storage where you provision performance (IOPS and throughput) independently of capacityDemanding databases and analytics; supported on newer machine series
Local SSDPhysically attached, very fast, temporaryScratch data and caches; data is lost when the VM stops (by default) or is deleted

GPUs or TPUs

GPUsTPUs
WhatGraphics processors from NVIDIA, general-purpose acceleratorsGoogle's Tensor Processing Units, designed for ML
StrengthBroad framework support, graphics, many ML workloads, CUDA-based codeLarge-scale training and inference of ML models, especially with JAX, TensorFlow and PyTorch
How to useAttach to Compute Engine VMs or GKE nodes; accelerator-optimized machine typesCloud TPU VMs or GKE TPU node pools

Choose GPUs when software depends on CUDA or needs broad compatibility; choose TPUs for large ML training and inference at scale where the framework supports them. Check regional availability and quota for both.

A worked scenario

A company moves a licensed Windows application that needs a specific OS configuration (Compute Engine), runs its new microservices in containers with Kubernetes tooling (GKE), hosts a public API with spiky traffic (Cloud Run), resizes images when files land in a bucket (Cloud Run functions), and deploys a customer-support agent (Agent Runtime). Its database VM uses a regional Persistent Disk so it can fail over to another zone.

How the exam asks about this

  • "Full control of the OS for a legacy app." Compute Engine.
  • "Stateless HTTP container with minimal operations, scale to zero." Cloud Run.
  • "Disk data must survive a zone failure." Regional Persistent Disk.
  • "Set performance independently of disk size." Hyperdisk.
  • "Fastest temporary scratch space." Local SSD.

What to remember for the exam

  • Compute Engine (control), GKE (Kubernetes), Cloud Run (serverless containers), Cloud Run functions (event code), Agent Runtime (AI agents).
  • Availability policy: on host maintenance MIGRATE or TERMINATE, automatic restart; GPU VMs must TERMINATE.
  • Prefer OS Login over metadata SSH keys.
  • Zonal PD for most disks, regional PD for cross-zone HA, Hyperdisk for tunable performance, Local SSD for temporary speed.
  • GPUs for broad compatibility, TPUs for large-scale ML.
Watch out

By default, data on Local SSD does not survive stopping or deleting the VM. Never keep the only copy of important data there.

Common mistakes

Choosing GKE for a single simple container. Cloud Run needs far less management.

Expecting zonal disks to survive a zone outage. Use regional Persistent Disk or snapshots.

Forgetting quota and zone availability for accelerators. GPUs and TPUs are not in every zone.

Check yourself

  • Which disk type replicates data synchronously across two zones?

    Regional Persistent Disk.

  • What must the on host maintenance policy be for a VM with GPUs?

    TERMINATE, because GPU VMs cannot live migrate.

  • Which compute option deploys and manages AI agents in production?

    Agent Runtime on Gemini Enterprise Agent Platform.

Topic 1 of 9 in Planning and implementing a cloud solution

Test yourself on Planning and implementing a cloud solution

The full Google Cloud Associate Cloud Engineer question bank has 661 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Google Cloud. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.