How to stop and start VMs manually
- Web console
- CLI
- In the sidebar, go to Compute → Virtual machines.
-
Find VMs with the maintenance label.
Example

- Click → Stop for these VMs.
- In the window that opens, confirm stopping the VM.
- When the VM status changes to Stopped, click → Start.
- In the window that opens, confirm starting the VM.
How to stop and start VMs automatically by using autohealing
You can create a VM with the autohealing function. It allows a VM to automatically stop and start each time maintenance is scheduled. As a result, the applications on this VM are highly available. To create a VM that stops and starts automatically during maintenance events:-
Make sure you are in a group that has the
adminrole within your tenant or project; for example, the defaultadminsgroup. You can check this in the Administration → IAM section of the web console. - Create a service account.
-
Add it to the default
viewersgroup:- CLI
-
Get the ID of the
viewersgroup:In the command, specify your Tenant ID. -
Get the ID of the service account:
-
Add the service account to the
viewersgroup:
-
Create a VM. In its configuration, specify the following:
- Settings that allow connections to this VM.
-
Created service account:
- Connect to the VM.
-
Install
jqon the VM: -
Go to the
/usr/local/bin/directory: -
Create the
vm_maintenance.shfile: -
Add the following Bash script to the file:
-
Make the file executable:
-
To make the script run continuously and restart it when the VM fails or reboots, add a
systemdunit to the script: -
Start the service created with the
systemdunit, and let it restart in case of the VM reboot:The output example is the following: