On-Host Maintenance in Compute Engine: Migrate vs Terminate on the ACE Exam

Ben Makansi
December 19, 2025

On-host maintenance is one of those Compute Engine settings that comes up on the Associate Cloud Engineer exam in a narrow but specific way. This article covers what it does, the two values you can choose from, when each one is appropriate, and the patterns I see when this topic shows up on the ACE exam.

It does not cover the underlying virtualization details, every edge case where live migration is unavailable, or the specific machine types that have restrictions. You can read the Google docs for those if you ever need them. The goal here is to give you what you need for the Associate Cloud Engineer exam, not a complete reference.

What on-host maintenance actually is

The word "maintenance" makes this sound scarier than it usually is in practice. What is actually happening is this. Your VM runs on a physical machine in a Google data center. That physical machine occasionally needs maintenance. Security patches, hardware replacements, the kind of thing that has to happen on any server eventually. When Google needs to do that work, they have to do something with your VM. The on-host maintenance setting controls what.

The two settings

The setting has two values. Migrate VM instance, and Terminate VM instance. Migrate is the default. If you do nothing when you create a VM, it uses Migrate.

Migrate VM instance does what is called live migration. Google moves your VM, while it is still running, to a different physical host that is not undergoing maintenance. The VM stays up. Network connections stay open. Memory state is preserved. From the application's perspective, almost nothing has changed. There can be a brief performance dip during the migration, but no actual downtime in most cases. This is honestly one of the more impressive pieces of infrastructure GCP offers and you do not have to do anything to get it.

Terminate VM instance is the alternative. With this setting, when the host needs maintenance, the VM is stopped. There is also a separate setting called Automatic Restart that controls whether the VM is brought back up after the maintenance is done. So with Terminate plus Automatic Restart enabled, your VM gets stopped and then restarted on a healthy host. With Terminate and Automatic Restart disabled, the VM stays stopped until someone starts it manually.

When you would actually choose Terminate

Migrate is the right choice for almost every general-purpose workload. The cases where Terminate is appropriate are narrow.

The biggest one is GPU workloads. Not all GPU configurations support live migration, so those VMs have to be terminated and restarted. Sole-tenant nodes in some configurations also have to use Terminate. There are also some specialized workloads where the brief performance dip of a migration is itself unacceptable, and a clean stop is preferred over a degraded transition.

For a typical web application, an API server, a database, a managed instance group of stateless workers, all of these should use Migrate. That is what the ACE exam expects you to choose unless the question explicitly describes one of the narrow scenarios above.

What the exam actually tests

Two scenario patterns show up on the Associate Cloud Engineer exam for this topic, and they are pretty distinctive.

The first pattern describes a VM workload that needs to stay available during Google's infrastructure maintenance. The question asks how to ensure that. The answer is to set on-host maintenance to Migrate VM instance. That is it. The question is testing whether you know the default behavior and that it can be changed.

The second pattern is a question about why a workload was unexpectedly stopped during a maintenance event. The answer is usually that someone configured on-host maintenance to Terminate, intentionally or otherwise. If the workload should have stayed up, the fix is to switch back to Migrate.

If you see anything in the question about live migration, host events, infrastructure maintenance, or VM availability during maintenance, on-host maintenance is the setting being tested. There are not really other services or features that overlap with this one, which makes it easier than most exam topics once you know what to look for.

Setting it from the command line

If you want to see this in practice, here is the gcloud command:

gcloud compute instances set-scheduling INSTANCE_NAME \
  --maintenance-policy=MIGRATE \
  --zone=us-central1-a

The two values that maintenance-policy accepts are MIGRATE and TERMINATE. You can also set Automatic Restart with the same command using the --restart-on-failure flag.

The bottom line

On-host maintenance has two settings. Migrate keeps the VM running through Google's infrastructure maintenance via live migration. Terminate stops the VM during maintenance, with an optional Automatic Restart afterward. Migrate is the default and is the right choice for almost every general-purpose workload. Terminate is for narrow cases like certain GPU workloads.

If a question describes a workload that should stay up during maintenance, the answer is Migrate. If a workload was stopped during maintenance, somebody had it set to Terminate.

My Associate Cloud Engineer course covers on-host maintenance in the Compute Engine section alongside the other VM settings the exam tests, including Automatic Restart, Preemptibility, and how these settings interact with managed instance groups.

arrow