Use placement groups

This guide shows you how to create and manage placement groups using the evroc CLI.

Placement groups control how VMs are distributed across physical hardware to improve availability and resilience.

For information about placement groups and how they work, see Placement Groups.

Prerequisites

  • Access to an evroc organization and project
  • evroc CLI installed and configured

Create a placement group

Create a placement group with the spread strategy to ensure VMs run on different physical hosts:

evroc compute placementgroup create my-pg \
  --zone=a \
  --strategy-type spread

See Create a Placement Group in the API reference.

Add a VM to a placement group

Add a VM to a placement group when creating it:

evroc compute virtualmachine create myvm \
  --zone=a \
  --running=true \
  --vm-virtual-resources-ref=a1a.s \
  --disk=mybootdisk \
  --boot-from=true \
  --placement-group=my-pg

Add an existing VM to a placement group (the VM must be stopped first):

evroc compute virtualmachine update myvm --running=false

Wait for the VM to stop, then add it to the placement group:

evroc compute virtualmachine update myvm --placement-group=my-pg

Start the VM again:

evroc compute virtualmachine update myvm --running=true

View placement group details

View information about a placement group, including which VMs are members:

evroc compute placementgroup get my-pg

See Get a Placement Group in the API reference.

List placement groups

List all placement groups in your project:

evroc compute placementgroup list

See List Placement Groups in the API reference.

Delete a placement group

Delete placement groups you no longer need. A placement group must not contain any VMs before you can delete it.

evroc compute placementgroup delete my-pg

See Delete a Placement Group in the API reference.

Next steps