Skip to content

Affinity Groups

Affinity Groups allow the customer user or administrator to influence if instances should run on the same host or different hosts in the underlying infrastructure. This feature allows Users to specify the affinity group to which an Instance should belong and operate under.

  • Instances with an “Anti-Affinity” group will not live on the same host.
  • Instances with an “Affinity” group will live on the same host.

Affinity Groups are defined at the Account level.

Affinity Groups can be attached to Instances when they are created. Affinity Groups can also be changed on Instances from existing Instances, but the Instance must be stopped before the Affinity Group can be changed.

Create New Group

  1. To create a new Affinity Group, log into the CloudStack with an account that has the permissions to add Affinity Groups.
  2. From the main menu, choose Compute > Affinity Groups.
  3. Click on Add new Affinity Group
  4. A dialog box will pop up. Fill out the name of the group, the description, and then the type.

Add during Instance Creation

  1. During Instance creation, one of the advanced options is to assign an Instance to an Affinity Group. Entering the Advanced Options menu will allow the Instance to be added to the Affinity Group upon completion.
  2. Once the Instance is created, it will belong to the Affinity Group assigned to it.
  3. The Instance will show what affinity group it belongs to in the Instance details.

Add/Change Existing Instances

  1. To use new Affinity Groups on existing instances, the instance must be stopped first.
  2. From the CloudStack main page, click on Compute > Instances
  3. Click on the Instance name to go into the Instance details.
  4. On the Instance menu screen, select the Stop Instance button.
  5. A dialog box will come up asking to confirm. Clicking OK will start the process.
  6. Once the Instance is shut down, the option Change Affinity will appear on the list of options in the upper right.
  7. Click on this button to bring up a list of affinity groups. Select the one that should be added to the Instance and click Ok.
  8. Once the Affinity Group has been set, the Instance will reflect that new assignment.
  9. The Instance can then be started again.

View Members

  1. The Affinity Groups themselves list which Instances are assigned to them in the CloudStack Portal.
  2. Click on Compute > Affinity Groups.
  3. Click on the Affinity Group name to bring up its details.
  4. Inside of the Affinity Group window, click on View Instances to see what instances are assigned to the rule.

Delete Group

  1. To remove an affinity group, go to Compute > Affinity Groups.
  2. Select the group to delete by clicking the box next to the group name and then click on the red “Delete” button.
  3. A dialog window will pop up asking for confirmation. Click OK.
  4. All Instances associated with this affinity group will be disassociated after it is deleted.