Remove an instance from a placement group
Written by
Remove an instance from a placement group.
If you remove a VM instance, you can delete it forever or add it back to the placement group.
CLI
API
If you don't have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
View a list of VM instances in the placement group:
$ yc compute placement-group list-instances --name my-group +----------------------+---------------------+---------------+---------+-------------+-------------+ | ID | NAME | ZONE ID | STATUS | EXTERNAL IP | INTERNAL IP | +----------------------+---------------------+---------------+---------+-------------+-------------+ | epdep2kq6dt5uekuhcrd | instance-in-group-1 | ru-central1-b | RUNNING | | 10.129.0.5 | | epdlv1pp54019j09fhue | instance-in-group-2 | ru-central1-b | RUNNING | | 10.129.0.30 | +----------------------+---------------------+---------------+---------+-------------+-------------+
-
Stop the VM instance that you want to remove:
$ yc compute instance stop instance-in-group-2 id: epdlv1pp54019j09fhue ... status: STOPPED
-
Remove the VM instance from the placement group. To do this, update the VM instance, leaving the placement group name (
placement-group-name
) blank:$ yc compute instance update --name instance-in-group-2 --placement-group-name=""
-
Check that the VM instance was removed from the group:
$ yc compute placement-group list-instances --name my-group +----------------------+---------------------+---------------+---------+-------------+-------------+ | ID | NAME | ZONE ID | STATUS | EXTERNAL IP | INTERNAL IP | +----------------------+---------------------+---------------+---------+-------------+-------------+ | epdep2kq6dt5uekuhcrd | instance-in-group-1 | ru-central1-b | RUNNING | | 10.129.0.5 | +----------------------+---------------------+---------------+---------+-------------+-------------+
Use the update.