This document explains the lifecycle of a Compute Engine instance, covering the various states it can go through from creation to deletion. To check the state of one or more instances, do one of the following:
By understanding the lifecycle of an instance, you can do the following more effectively:
Troubleshoot instance issues.
Manage instance resources.
Plan instance migrations.
Instance states
A compute instance can transition through different states as part of its lifecycle. When creating an instance, Compute Engine provisions resources to start it, after which the instance moves into staging and prepares for first boot. After the instance starts, it's considered running. A running instance can be repeatedly stopped and restarted, or suspended and resumed, until its deletion.
Compute Engine can set an instance to the following states. For a visual representation of an instance's lifecycle, see a diagram with all the instance states in this section.
PROVISIONING
: In the first stage of an instance, Compute Engine allocates resources for the instance.STAGING
: Compute Engine is preparing the instance for first boot due to one of the following reasons:Compute Engine is still creating and configuring the instance.
A user requested to restart or resume the instance, or Compute Engine is restarting or resuming the instance for a programmed restart.
In this state, the instance isn't running yet.
RUNNING
: Compute Engine is booting up the instance or the instance is running. In this state, Compute Engine can stop, suspend, repair, or delete the instance.STOPPING
: Compute Engine is shutting down the instance to begin the stop or delete operation. This state occurs after one of the following occurs:A user requested the stop or delete the instance.
Compute Engine is stopping or deleting the instance for a programmed stop or deletion.
The instance is stopping after an hardware failure occurred.
If the stop operation didn't occur due to an hardware failure, then the time the instance takes to cleanly shut down its guest operating system (OS) varies based on the instance type. After shutting down the instance's guest OS, Compute Engine does one of the following within a few seconds:
If a stop operation is running, then Compute Engine sets the instance state to
TERMINATED
.If a delete operation is running, then Compute Engine permanently deletes the instance, and, depending on the instance configuration or delete command options, it also deletes the attached resources. The instance and its attached resources can't be recovered.
TERMINATED
: Compute Engine has completed the stop operation. In this state, you can restart the instance when needed, or delete the instance if you no longer need the instance and its attached resources.REPAIRING
: Compute Engine is repairing an instance that is part of a managed instance group (MIG). Compute Engine repairs an instance if it encounters an internal error or the instance's host server is unavailable due to maintenance. While an instance is in repair, the following happens:You can't use the instance.
Google Cloud doesn't bill your for the instance.
The service level agreement (SLA) doesn't cover the instance.
If Compute Engine successfully repairs the instance, then it returns the instance state to its original state before the repair operation began. This state can be
STAGING
,RUNNING
,SUSPENDING
, orSTOPPING
.SUSPENDING
: Compute Engine has started the suspend operation of the instance after a user requested to suspend it. In this state, you can only wait for the suspend operation to complete.SUSPENDED
: Compute Engine has completed the suspend operation on the instance. In this state, you can resume the instance or delete the instance if you no longer need it. If an instance remains in theSUSPENDED
state for more than 60 days, then Compute Engine stops the instance and transitions its state toTERMINATED
.
The following diagram shows the different states that Compute Engine can set an instance to:
Hardware failure
Rarely, a compute instance might fail due to an unexpected outage, hardware error, or another system issue. Google recommends mitigating hardware failures by using persistent storage volumes, routinely backing up your data, and designing your system so that a single instance failure isn't catastrophic. For more information, see how to design robust systems.
If an instance fails, then Compute Engine automatically restarts the instance using the same boot disk, metadata, and instance settings. To modify the automatic restart behavior of an instance, see Set VM host maintenance policy.
What's next
Learn how to view the status of one or more compute instances:
Learn more about suspending, stopping, or resetting instances.
Learn more about live migration during maintenance events.