Affinity and anti-affinity rules allow you to spread a group of virtual machines across different hosts or keep a group of virtual machines on a particular host.

An affinity rule places a group of virtual machines on a specific host so you can easily audit the usage of those virtual machines. An anti-affinity rule places a group of virtual machines across different hosts, which prevents all virtual machines from failing at once in the event that a single host fails.

You can view existing affinity and anti-affinity rules and their properties, such as the virtual machines affected by the rules and whether the rules are enabled.

Add an affinity rule to place a specific group of virtual machines on a single host so you can audit the usage of those virtual machines.

Add an anti-affinity rule to place a specific group of virtual machines across multiple hosts to prevent simultaneous failure of those virtual machines in the event that a single host fails.

Edit an affinity or anti-affinity rule to enable or disable the rule, add or remove virtual machines, or change the rule's name.

You can delete an existing affinity or anti-affinity rule if you no longer want to use it.