A Windows Azure Affinity Group is a way of grouping Azure resources by geographical location or region and also keeping them as close together within that region as possible. If you were to only specify a region when creating VM’s Azure would, for example, place those VM’s in a datacenter that corresponds to that region. If you create an Affinity Group and assign VM’s to it those machines not only get placed in the same datacenter but also as close together as possible within that datacenter. This will increase in performance as Azure datacenters are quite large. Data does not have to travel as far and latency is decreased.
Let’s use an example of an application server that relies on a SQL server for the data it’s presenting. Obviously you wouldn’t want that application server located in California and the SQL server in Atlanta. Placing the application and SQL server in the same affinity group ensure they are communicating with each other in the same location (region) and that they could potentially be located in the same rack. The screenshots below should bring some additional additional clarity.
On the Azure homepage click on settings
Then click on affinity groups on the top of the page (tabs)
Then click on “add” at the bottom
Assign an appropriate Name and Description. Choose the Azure subscription you want to assign this Affinity Group to and pick a region
Click the check in the lower right hand corner and your Affinity Group is complete. When creating Azure VM’s you can now assign them to any Affinity group you have created.
We curently have a East US and a West US Affinity Group for each subscription we’ve created. This allows us to place machines in 2 regions or datacenters. Think of it in terms (theoretically) of having purchased a rack in a production site in Atlanta and a rack in a DR site in California.
The complete list of options for Affinity Group regions are as follows: