Instance life cycle

This page describes the instance life cycle of a single VM, starting from its creation through its potential deletion.

An instance can transition through many instance states as part of its life cycle. When you first create an instance, Compute Engine provisions resources to start the instance. Next, the instance moves into staging, where it prepares for first boot and then it finally boots up and is considered running. During its lifetime, a running instance can be repeatedly stopped and restarted or suspended and resumed.

An instance can have the following states:

  • PROVISIONING. Resources are being allocated for the instance. The instance is not running yet.
  • STAGING. Resources have been acquired and the instance is being prepared for first boot.
  • RUNNING. The instance is booting up or running. You should be able to ssh into the instance soon, but not immediately, after it enters this state.
  • STOPPING: the instance is being stopped. This can be because a user has made a request to stop the instance or there was a failure. This is a temporary status and the instance will move to TERMINATED.
  • REPAIRING - The instance is being repaired. This can happen because the instance encountered an internal error or the underlying machine is unavailable due to maintenance. During this time, the instance is unusable. If repair is successful, the instance returns to one of the above states.
  • TERMINATED. A user shut down the instance, or the instance encountered a failure. You can choose to restart the instance or delete it.
  • SUSPENDING. The instance is being suspended. A user has suspended the instance.
  • SUSPENDED. The instance is suspended. You can choose to resume or delete it.

The following diagram shows the transition between each instance state:

Instance life cycle.

Stopping, suspending, or resetting an instance

You can stop or suspend an instance if you no longer need it but want to keep the instance around for future use. Whether you stop or suspend an instance depends on whether you need to preserve the guest OS memory and application state of the instance.

The following applies for both suspending and stopping an instance:

  • You pay for resources that are still attached to the VM instance, such as static IPs and persistent disk data.
  • You do not pay the cost of a running VM instance.
  • Ephemeral external IP addresses are released from the instance, but Google assigns new ephemeral external IP addresses when the instance is restarted or resumed. Static external IP addresses are retained. If you depend on an ephemeral external IP address remaining the same through restarts, you should promote the ephemeral external IP.

Stopping an instance

Stopping an instance causes Compute Engine to send the ACPI shutdown signal to the instance. Modern guest operating systems are configured to perform a clean shutdown before powering off in response to the power off signal. Compute Engine waits a short time for the guest to finish shutting down and then transitions the instance to the TERMINATED state.

You might want to stop an instance if:

  • You do not want to pay for an instance you do not currently need but want to keep the instance around and retain its internal IPs, MAC address, and persistent disk for future use.
  • You do not need to preserve the guest OS memory, device state, and application state.
  • You want to change certain properties of the instance that require you to first stop the instance.

You can restart a stopped instance when you need to use it again.

Suspending an instance

Suspending an instance sends an ACPI S3 suspend signal to the instance's operating system. Suspending an instance is analogous to closing the lid of your laptop or putting the instance into a suspended state. When you suspend an instance, it transitions to SUSPENDED state.

You might want to suspend an instance if:

  • You do not need the instance at this time but want to be able to bring it back up quickly with its OS and application state already initialized.
  • You do not mind paying for Google to preserve the state of your VM instance.

You can resume a suspended instance when you need to use it again.

Resetting an instance

Alternatively, you can reset an instance to wipe the memory contents of the VM instance and reset the virtual machine to its initial state. Resetting an instance causes an immediate hard reset of the VM; the VM does not do a graceful shutdown of the guest OS. However, the VM retains all persistent disk data and none of the instance properties change. The instance remains in RUNNING state through the reset.

Comparison table

Use the following table to compare how stopping, suspending, and resetting an instance affects the instance and its resources:

Stopping Suspending Resetting
Billing Google does not charge for VM resources while they are in STOPPED state. Google charges for storing the preserve state of suspended VMs. Because the VM remains in the RUNNING state when it is resetting, Google charges for instances according to standard VM prices.
VM state TERMINATED SUSPENDED RUNNING
Persistent disks Persistent disks are maintained, even when persistent disks are marked for auto-delete.

You are charged for persistent disks associated with stopped virtual machines, just like you would be charged for a persistent disk that is not associated with any virtual machine.
Persistent disks are maintained, even when persistent disks are marked for auto-delete.

You are charged for persistent disks associated with suspended virtual machines, just like you would be charged for a persistent disk that is not associated with any virtual machine.
Persistent disks are maintained, even when persistent disks are marked for auto-delete.

You are charged for persistent disks as long as the VM remains in a RUNNING state.
RAM and VM state Reset to power-on state, no data is saved. Guest OS and application state is preserved and restored when the instance is resumed.
You are charged a specific rate for storing preserved data. For more information, see Billing for suspended instances.
Reset to power-on state, no data is saved.
GPUs GPUs are not charged when an instance is stopped.

A GPU attached to a stopped instance does not count against your project quota.
Not supported.

You cannot suspend an instance with a GPU attached.
You are charged standard GPU prices.
Local SSDs Not supported.

You cannot stop an instance with a local SSD attached.
Not supported.

You can suspend an instance with a local SSD, but you must explicitly discard the local SSD data in the process.
Local SSDs are maintained.
External ephemeral IPs Ephemeral IPs are released when an instance is stopped, but a new ephemeral IP address is acquired when the instance is restarted. Ephemeral IPs are released when an instance is suspended, but a new ephemeral IP address is acquired when the instance is restarted. Ephemeral IPs are released when an instance is reset, but a new ephemeral IP address is acquired when the instance restarts.
External static IPs Static external IPs are maintained.

Static IPs assigned to stopped instances are charged as if they are not attached to any instance. For more information, see pricing.
Static external IPs are maintained.

Static IPs assigned to stopped instances are charged as if they weren't attached to any instance. For more information, see pricing.
Static external IPs are maintained.
Internal IPs or MAC address Internal IPs and MAC addresses are maintained. Internal IPs and MAC addresses are maintained. Internal IPs are released when a VM is deleted.

MAC addresses are generated based on the internal IP. If you want to reuse the MAC address, set the same internal IP address or use a reserved internal IP.
VM metadata VM metadata is maintained. VM metadata is maintained. VM metadata is maintained.

Checking an instance's status

Every instance reports its status as part of the instance's properties. Check an instance's status: if you are experiencing issues with the instance, if you just started the instance and want to confirm that the instance is running, or if you want to confirm that the instance has been suspended or stopped.

List all instances and their status:

gcloud compute instances list

Describe the status of a single instance:

gcloud compute instances describe example-instance

What's next