This document describes the lifecycle of a virtual machine (VM) instance, starting from its creation through its potential deletion.
A VM instance can transition through many states as part of its lifecycle.
- When you create a VM, the UI sending a request to alocate resource and start the VM.
- Next, the VM moves into creating, where it prepares for first boot.
- After that, a VM is considered running.
- During its lifetime, a running VM can be repeatedly stopped and restarted.
A VM can be in one of the following states:
CHECKING
: the UI is checking the VM status to the API.CREATING
: resources are allocated for the VM and prepares for the first boot. The VM is not running yet.RUNNING
: the VM is running.RESTARTING
: the VM is being restarted since you requested to restart a running VM.UPGRADING
: the VM is being upgraded. You requested to resize. This is a temporary status until the VM is running again.STOPPING
: the VM is being stopped. You requested a stop. This is a temporary status after which the VM enters the STOPPED status.STOPPED
: the VM is stopped or turned off. Either you requested a stop, or a failure occurred. When it is stopped, the VM is unusable. You are only billed for the disk usage.STARTING
: the VM is being started because you requested to start a stopped VM. This is a temporary status until the VM is running again.FAILED
: the VM is failed processing your request.ERROR
: the VM is in the error state.
You can restart a VM only if the VM is in the RUNNING state.
Restarting a VM doesn’t change any of its VM properties. The VM retains its public IPs, internal IPs, persistent disks, local SSD disks (if any), and machine type.
To restart a VM, perform these actions:
- Go to the Compute page from Compute >> VMs menu
- Click on the action menu of the VM you want to stop, then choose Restart; or click on the VM name to see its detail then click on the refresh icon
- Click Yes button to confirm your action
Stopping a VM causes the system sending shutdown signal to the VM.
You might want to stop a VM for several reasons:
- You no longer need the VM but want the resources that are attached to the VM—such as its IPs, and persistent disk.
- You don’t need to preserve the guest OS memory, device state, or application state.
- You want to change certain properties of the VM that require you to first stop the VM.
- You can start a terminated VM when you need to use it again.
To stop a running VM, you can perform these actions:
- Go to the Compute page from Compute >> VMs menu
- Click on the action menu of the VM you want to stop, then choose Update Status; or click on the VM name to see its detail then click on the setting icon
- Click on the status switch until the label is changed to STOPPED
- Click Save button
Additionally, if you attached any resources to the VM, those resources remain attached until you manually detach them or you delete the VM.