When you deploy a Virtual Machine and want High Availability, you have one of two options which are mutually exclusive:
When you want to deploy Virtual Machines that are close together along with its disks to ensure the lowest latency possible, you can assign Azure Virtual Machines to a Proximity Placement Group.
Some relationships Proximity Placement Groups have to resources are:
- Assigning an Availability Set to a Proximity Placement Group so that Virtual Machines associated with an Availability Set leverage the Fault Domain and Update Domain capabilities of an Availability Set while also being located within the same “Network Spine” which is typically the same Datacenter. These Virtual Machines would carry a 99.95% SLA.
- Virtual Machines not in an Availability Set, but in the same Proximity Placement Group, are also located within the same “Network Spine” but could potentially land up in the same Network Rack sharing the same networking and power components. This carries a lower Service Level Agreement (SLA) than Virtual Machines that are in an Availability Set. The SLA depends on the type of disk used:
- 99.9% SLA if using Premium or Ultra SSD Managed Disk(s)
- 99.5% SLA if using Standard SSD Disk(s)
- 95% SLA if using Standard HDD Disk(s)
- Virtual Machines not in an Availability Set, but in an Availability Zone and also a Proximity Placement Group, are also located within the same “Network Spine” but could potentially land up in the same Network Rack sharing the same networking and power components. This carries a higher Service Level Agreement (SLA) than Virtual Machines that are in an Availability Set with a 99.99% SLA.
Reference to Azure Virtual Machine SLAs: SLA for Virtual Machines.
The scope of this article isn’t to go over an overview of Availability Sets, Availability Zones, or Proximity Placement Groups in detail. It is expected you, the reader, are familiar with these technologies.
What I go into below is how you can pin an Availability Set to a specific Availability Zone. Another way to look at it is, how can a workload that is comprised of multiple Virtual Machines leverage 2 or more Availability Zones and Availability Sets at the same time. With this, you can have the benefit of having Virtual Machines spread across Availability Zones but still leverage Availability Sets to ensure in a deployment where you have multiple Virtual Machines in more than one Availability Zone within a Region can leverage Availability Sets to ensure they are in separate Fault Domains and Update Domains.
For example, a Highly Available application that consists of:
- 2 Virtual Machines in Availability Zone 1 in Central US also leveraging an Availability Set with at least 2 Fault Domains and 2 Update Domains
- 2 Virtual Machines in Availability Zone 2 in Central US also leveraging an Availability Set with at least 2 Fault Domains and 2 Update Domains
Then creating a zone-redundant Azure Load Balancer or Azure Application Gateway to load balance traffic to your 4 Virtual Machines.
Proximity Placement Groups Alignment Process is the Magic
Understanding Proximity Placement Groups and the alignment process is the key to understanding how you can pin Availability Sets into an Availability Zone. The key to pinning an Availability Set into an Availability Zone lies with this statement in the Proximity Placement Group article linked in the last sentence, “When you ask for the first virtual machine in the proximity placement group, the data center is automatically selected.”
When I deploy my first Azure Virtual Machine in a Proximity Placement Group, the alignment process will align the Proximity Placement Group, the datacenter is automatically selected and any future VMs that are in that same Proximity Placement Group will be aligned to that same datacenter.
Let’s look at the relationships with Proximity Placement Groups:
- An Availability Set can be assigned to a Proximity Placement Group
- A Virtual Machine can be assigned to a Proximity Placement Group
- A Virtual Machine can be assigned to an Availability Set.
Thinking about that last bullet, if I create a Virtual Machine into a Proximity Placement Group and an Availability Set that’s assigned to a Proximity Placement Group, I can’t select an Availability Zone though. So how can I ensure all Virtual Machines in that Availability Set are in a specific Availability Zone? Again, think back to the statement, “When you ask for the first virtual machine in the proximity placement group, the data center is automatically selected.”
The key to making all this work is as follows:
- Create a Proximity Placement Group
- Create an Availability Set that’s assigned to the Proximity Placement Group
- Create a Virtual Machine (not assigned to the Availability Set) but assign the Virtual Machine to the Proximity Placement Group. With this “anchor” Virtual Machine, you’ll choose the Availability Zone you want your Proximity Placement pinned to. Therefore, the datacenter in that Availability Zone will automatically be selected.
- Deploy your subsequent Virtual Machines into the Availability Set that’s assigned to the Proximity Placement Group. When creating these Virtual Machines, make sure to also specify the Proximity Placement Group as well. These Virtual Machines will all automatically be aligned/pinned to that specific Availability Zone and be pinned to that single “Network Spine” that you provisioned your anchor Virtual Machine into.
Deployment Process in Action
Create a Proximity Placement Group into an Azure Region that supports Availability Zones.
Create the Availability Set and on the Advanced tab, choose the Proximity Placement Group you selected above.
Create your anchor Azure Virtual Machine. This Azure Virtual Machine will not be in the Availability Set and will only be used for anchoring purposes. Be sure to select the Availability Zone you want all future Virtual Machines in your Availability Set and Proximity Placement Group pinned to.
On the Advanced Page, be sure to select the Proximity Placement Group we created.
Now that we have our Proximity Placement Group, Availability Set, and our Anchor Virtual Machine created, go into your Proximity Placement Group and let’s verify the Availability Set and Anchor Virtual Machine are aligned.
And because they are aligned and we know that the datacenter for the Proximity Placement Group was automatically selected; because again, refer to the documented statement mentioned earlier, “When you ask for the first virtual machine in the proximity placement group, the data center is automatically selected.” Any subsequent Virtual Machines deployed into the Availability Set will automatically be deployed into the Availability Zone we selected and you have the benefits of ensuring these Virtual Machines will be deployed into separate Fault Domains and Update Domains based on the configuration of your Availability Set.
I hope this helps and feel free to ask any questions in the comments.