Deploying Compute Engine
Google ACE ACE · Planning and implementing a cloud solution
Launching a VM: the decisions
Creating a Compute Engine virtual machine means making a handful of decisions, and the exam tests each one. You choose the region and zone (where the VM runs), the machine type (how many vCPUs and how much memory, predefined or custom), the boot disk (the operating system image and disk type and size), additional data disks if needed, the network (which VPC and subnet, and whether the VM gets an external IP), the service account the VM runs as (which decides what Google Cloud APIs the VM can call), and the availability policy (what happens on host maintenance and whether the VM restarts automatically). The console walks through these in order; the command line equivalent is gcloud compute instances create with flags for each choice.
A few of these decisions carry exam traps. The boot disk image can be a public image (Debian, Ubuntu, Windows Server, and others maintained by Google or third parties), a custom image you built, or a snapshot. The service account matters more than most beginners expect: a VM's service account and its access scopes decide what the software on the VM can do in Google Cloud — read from a bucket, write to a database, call an API. The default Compute Engine service account has broad access in older projects, but best practice is a dedicated service account with only the roles the workload needs. Access scopes are a legacy mechanism that limits what a VM's service account can do; modern best practice is to use IAM roles on the service account and set the scope to allow full access to all Cloud APIs, letting IAM do the restricting. The exam may test that scopes are a ceiling, not a grant: a scope cannot give a permission that IAM does not allow.
Availability policy and host maintenance
The availability policy controls what happens when Google needs to maintain the physical host a VM runs on. There are two options: migrate (live migration — the VM is moved to another host without stopping, which is the default for most machine types) or terminate (the VM is stopped during maintenance). Live migration is almost always the right choice, but it is not available for VMs with GPUs, local SSDs in some configurations, or sole-tenant nodes — those must use terminate. The policy also includes automatic restart: if the VM crashes or is terminated by a host event, Google restarts it automatically. Automatic restart should be on for anything that must stay up, and off for batch VMs managed by a group (where the group handles replacement). Preemptible and Spot VMs cannot use live migration — they are terminated when reclaimed.
SSH access and OS Login
There are several ways to connect to a Linux VM: the browser-based SSH button in the console, the gcloud compute ssh command, or a standard SSH client with keys you manage. The exam-relevant mechanism is OS Login: instead of managing SSH keys per VM, OS Login ties SSH access to IAM. When OS Login is enabled (at the project or VM level), a user connects with their Google identity, and IAM roles decide who can log in (the Compute OS Login role) and who can sudo (the Compute OS Admin Login role). SSH keys are then managed centrally through IAM and expire automatically. OS Login is the recommended approach and can be enforced organization-wide with an organization policy. The older pattern — adding SSH keys to project or instance metadata — still works but is harder to manage and audit, and the exam treats OS Login as the better answer whenever centralized access control is mentioned.
Instance templates and managed instance groups
An instance template is a reusable definition of a VM: machine type, image, disks, network, service account, and startup script. Templates are immutable — you cannot edit one; you create a new version — and they are the building block for managed instance groups (MIGs). A MIG creates and manages a group of identical VMs from a template: it keeps the group at the target size (recreating VMs that fail), can autoscale the number of VMs based on CPU utilization, load balancer utilization, or a Cloud Monitoring metric, and can perform rolling updates when you point it at a new template, replacing VMs gradually so the service stays up. A regional MIG spreads VMs across zones in a region; a zonal MIG keeps them in one zone.
Autoscaling deserves care. The autoscaler adds VMs when the metric exceeds the target and removes them when it drops, respecting the minimum and maximum instance counts you set. A cool-down period prevents flapping: after a scale-out, the autoscaler waits before scaling again so the new VMs have time to start serving. The exam often tests the relationship between the template and the group: changing the template does not change existing VMs — you must trigger a rolling update (or recreate the VMs) for the new template to take effect. And a startup script in the template (run at boot) is the standard way to install software and configure a VM automatically, rather than configuring each VM by hand.
VM Manager
VM Manager is a suite of tools for managing fleets of VMs: OS patch management (schedule and apply OS patches across VMs), OS inventory management (see which packages and patches are installed on every VM), and OS configuration management (apply consistent configuration using OS policies). It requires the OS Config agent running on the VMs. For the exam, the key association is simple: if the question asks about patching many VMs on a schedule, or finding out which VMs are missing a security patch, the answer is VM Manager — not logging in to each VM, and not a startup script.
Startup scripts, shutdown scripts, and metadata
Every VM has access to a metadata server at a well-known internal IP address, which serves information about the instance — its name, zone, service account, and any custom metadata you set. Startup scripts are stored as metadata and run automatically when a VM boots: installing packages, configuring services, or pulling application code. They are the standard way to configure VMs in a managed instance group, because the script lives in the instance template and runs identically on every VM the group creates. Shutdown scripts run when a VM is stopped or deleted, and are used for graceful cleanup — deregistering from a load balancer, flushing a cache, or uploading final logs. Both script types can also be stored in Cloud Storage and referenced from metadata, which keeps the template clean when the script is long.
Custom metadata is also how you pass configuration into a VM: key-value pairs set at the project level (inherited by all VMs) or the instance level (specific to one VM), which the startup script or application can read from the metadata server. A common pattern is storing an environment name or a configuration flag as metadata rather than baking it into the image. One exam-relevant detail: SSH keys can also be stored in metadata, which is the legacy way to manage SSH access — but OS Login is the recommended replacement, as covered above. When a question involves configuring many VMs consistently, the answer is a startup script in the instance template; when it involves passing per-VM configuration, the answer is custom metadata.
Exam traps to watch for
- Editing an instance template to change running VMs: templates are immutable, and existing VMs only change through a rolling update or recreation.
- Managing SSH keys in metadata when the question wants centralized access control: OS Login with IAM roles is the recommended answer.
- Assuming access scopes grant permissions: scopes only limit what a service account can do; IAM roles grant the permissions.
- Expecting live migration for GPU or Spot VMs: those must terminate on host maintenance events.
Practice questions
Test yourself on this guide. Answers are checked instantly, with a full explanation for each question.
Q1.A team runs a web service on a managed instance group. They have updated the application and created a new instance template with the new version. How should they roll the update out to the running VMs?
Explanation: A rolling update replaces the group's VMs gradually with instances built from the new template, keeping the service available throughout. Instance templates are immutable and cannot be edited. Deleting and recreating the group causes an outage. Manual SSH updates defeat the purpose of a managed group and leave the VMs inconsistent with the template.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — creating an autoscaled managed instance group by using an instance template
Q2.A security team wants SSH access to all VMs in a project to be controlled centrally through IAM, with no SSH keys stored in instance metadata. What should they enable?
Explanation: OS Login ties SSH authentication to IAM: users log in with their Google identity, and roles control who can log in and who can sudo, with no keys stored in metadata. Project-wide SSH keys in metadata are the old pattern the team wants to avoid. IAP TCP forwarding secures the connection path but does not manage SSH authorization. A firewall rule restricts source IPs but does not control who can authenticate.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — configuring OS Login
Q3.A VM runs a critical application that must keep running during Google Cloud host maintenance. Which availability policy setting should you choose?
Explanation: Live migration moves the running VM to another host without stopping it, which is exactly what a critical application needs during maintenance; automatic restart adds protection against crashes. Terminate stops the VM during maintenance, causing downtime. Spot VMs cannot use live migration at all — they are terminated when reclaimed.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — launching a compute instance (availability policy)
Q4.A company needs to apply a critical OS security patch to 200 VMs on a schedule, and verify afterward which VMs received it. Which tool should they use?
Explanation: VM Manager is built for fleet-wide OS management: patch management schedules and applies patches across many VMs, and OS inventory reports which packages and patches each VM has. Cloud Monitoring watches metrics, it does not apply patches. A startup script only runs when a VM boots and cannot patch running VMs on a schedule. Cloud Logging stores logs; it does not manage patching.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — configuring VM Manager
Q5.A VM's application needs to read objects from a Cloud Storage bucket. The VM currently uses the default Compute Engine service account with broad permissions. What is the best practice?
Explanation: Least privilege means a dedicated service account with only the permissions the workload needs, attached to the VM — the application then authenticates automatically with no key file. Granting broad roles at the organization level is the opposite of least privilege. Storing a key file on the VM creates a long-lived credential that can leak. Making the bucket public removes all access control.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — launching a compute instance (service accounts)
Q6.An autoscaled managed instance group has a minimum of 2 and a maximum of 10 instances, scaling on CPU utilization with a target of 60%. Traffic spikes and average CPU reaches 85%. What will the autoscaler do?
Explanation: The autoscaler adds instances when the metric exceeds the target, bounded by the maximum of 10, and it does so automatically — no approval is needed. It does not change machine types; vertical changes require a new template and a rolling update. The maximum is a hard cap, so it cannot add instances without limit.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — creating an autoscaled managed instance group by using an instance template
Q7.A developer wants to install a web server and copy application files onto every new VM created by a managed instance group, automatically at boot time. What is the best approach?
Explanation: A startup script in the instance template runs automatically on every VM the group creates, guaranteeing consistent configuration. Manual SSH does not scale and leaves VMs inconsistent. Cloud Functions cannot install software inside a VM. A pre-installed disk could work but is inflexible — updating the software means rebuilding the disk — and it does not configure the web server.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — creating an autoscaled managed instance group by using an instance template
Q8.Which statement about instance templates is correct?
Explanation: Instance templates cannot be modified after creation. Changing a group's configuration means creating a new template version and rolling it out — a rolling update replaces VMs gradually with the new definition. Templates are used for all MIG VMs, not only Spot VMs, and a group uses one template at a time.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — creating an autoscaled managed instance group by using an instance template