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 prepared for first boot, before it finally boots up and is considered running. A running instance can be stopped and restarted repeatedly during its lifetime.

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 can connect to the instance shortly 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 once the instance has stopped.
  • REPAIRING - The instance is being repaired. This can happen because the instance encountered an internal error. During this time, the instance is unusable. If repair is successful, the instance returns to one of the above states.
  • TERMINATED - A user stopped the instance, or the instance encountered a failure. Start the instance again or delete it.

The following diagram describes the typical transitions between each instance state:

Diagram of instance life cycle

Stopping or resetting an instance

You can stop an instance if you no longer need it but want to keep the instance around for future use. Alternatively, you can reset an instance if you just need to wipe the contents of the instance's memory or application state. When you stop an instance, the instance moves into a different instance state (TERMINATED) while resetting an instance keeps the instance in RUNNING state throughout the process.

Stopping an instance

Stopping an instance causes Compute Engine to send the ACPI Power Off 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.

The following applies for when stopping an instance:

  • You pay for resources 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 new ephemeral external IP addresses are assigned when the instance is restarted. Static external IP addresses are retained.

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, such as changing the machine type.

Restart a stopped 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.

Reset an instance if you need to clear the guest OS memory, the device state, or application of your VM, either for troubleshooting or to return your VM to its initial power-on state.

Deleting an instance

Deleting an instance removes the instance and its attached resources from your project with some exceptions. Specifically, Compute Engine retains persistent disks for a deleted instance if the disks have their auto delete status to false and any static external IPs will be returned to your project so you can use the IP again for another resource. Deleting a VM instance is permanent so you cannot restart a deleted instance. You can recreate the instance with the same name and properties but for all purposes, Compute Engine will treat this as a new instance with new properties (such as a new system-generated instance ID).

If you suspect you might need the instance in the future but do not need it at the moment, consider stopping the instance instead, so you can restart it later.

Comparison table

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

Stopping Resetting Deleting

Google does not bill VM resources once the VMs are in a TERMINATED state.

Specifically, when a VM is RUNNING and is in the process of being stopped (but is not yet TERMINATED), Google bills for vCPUs, memory, GPUs, and local SSD usage. Once the STOPPING state ends and a VM enters TERMINATED state, then Google stops billing for the above-mentioned resources.

Keep in mind that any other resources that are still attached to a TERMINATED VM will still incur charges, such as persistent disks, static external IP addresses, and so on.

Google bills VMs resources while the VM is being reset.

For all intents and purposes, Google views this VM as a RUNNING VM and standard pricing applies for the VM and any resources attached to the VM.
Google does not bill for deleted VM resources.
Virtual Machine State TERMINATED RUNNING N/A
Persistent Disks Persistent disks are maintained, even when persistent disks are marked for auto-delete.

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

You will continue to be charged for persistent disks as the VM remains RUNNING.
If you set the auto-delete state of persistent disks to false, then persistent disks will be retained.
You will continue to be charged for persistent disks as long as the disks exists in the project.
RAM and virtual machine state Reset to power-on state, no data is saved. Reset to power-on state, no data is saved. N/A
GPUs GPUs are not charged when an instance is stopped. A GPU attached to a stopped instance will not count against your project quota. GPUs continue to be billed according to standard GPU prices. GPUs are not charged once an instance is deleted.
Local SSDs You cannot stop or restart an instance with a local SSD attached to it. Local SSDs are maintained. Local SSDs are deleted along with the VM.
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 reset, but a new ephemeral IP address is acquired when the instance restarts. Ephemeral IPs are released when an instance is deleted.
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. See pricing page for details.
Static external IPs are maintained. Static external IPs are released back to your project.
Internal IPs / 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.
VM metadata VM metadata is maintained. VM metadata is maintained. VM metadata is deleted along with the VM

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 instance is running, or if you want to confirm the instance has been 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

Was this page helpful? Let us know how we did:

Send feedback about...

Compute Engine Documentation