Create DRS affinity rule
The DRS affinity rules are used in DRS clusters to keep certain virtual machines together on the same ESXi host. You can create these rules using vSphere Web Client:
1. Select your cluster from the inventory, go to Manage > Settings > DRS Rules, and click the Add button:
2. The Create DRS Rule window opens. Enter the name for the rule and choose the rule type. In this example, we will create a rule that will keep two VMs on the same host. Click Add to add the VMs:
3. Select the VMs you would like to run on the same host and click OK:
4. Click OK to create the rule.
To test the rule, select your DRS cluster from the inventory and go to Monitor > vSphere DRS. Because the VMs we’ve selected during the rule creation are running on different ESXi hosts, DRS recommends to run them on the same host: