# VM Affinity Anti-Affinity Rules

This document describes the method to create affinity and anti-affinity groups for your virtual machines.

Server groups are the mechanism to enable you to create groups of VMs with affinity or anti-affinity rules associated with them.

Server Groups are logical groups of virtual machines, so you can specify "Affinity" or "Anti-Affinity" policies while scheduling VMs. Server group membership impacts the placement of the VM on a host in your virtualized cluster in the following manner:

* An affinity policy for a server group specifies that all the virtual machines belonging to the server group should be provisioned on a single hypervisor.
* An anti-affinity policy for a server group specifies that each virtual machine in the server group should be hosted on a different hypervisor.

To create a Server Group, follow the steps below.

1. Navigate to **Virtual Machines** > **Server Groups** and click on the **Create Server Group** button.
2. Provide a descriptive name for the Server Group.
3. Select a policy: Affinity or Anti-Affinity.
4. Click the **Create Server Group** button.

You can now add a VM to this Server Group as part of the VM creation wizard.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.platform9.com/private-cloud-director/2026.1/virtualized-clusters/virtualmachine/vm-affinity-anti-affinity-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
