Availability Sets in Azure Virtual Machines
Azure Availability Sets are a logical grouping of virtual machines within an Azure datacenter that provides redundancy and high availability. They help ensure that your applications remain available during planned maintenance or unplanned hardware failures.
Understanding Availability Sets
An Availability Set consists of two main components:
- Update Domains (UDs): A group of virtual machines and underlying physical hardware that can be rebooted at the same time during planned maintenance. Azure ensures that only one Update Domain is rebooted at a time. By default, there are 5 UDs, but this can be increased.
- Fault Domains (FDs): A group of virtual machines that share a common power source and network switch. If there is a hardware failure within a Fault Domain, only the VMs in that FD are affected. Azure ensures that FDs are spread across different physical hardware. By default, there are 2 FDs in each Azure datacenter, but this can be increased.
Visual representation of Availability Sets with Update and Fault Domains.
Why Use Availability Sets?
Availability Sets are crucial for:
- High Availability: Minimizing downtime by distributing VMs across different hardware.
- Planned Maintenance: Ensuring that maintenance operations are performed in a rolling fashion, minimizing impact on your applications.
- Application Resiliency: Protecting your applications from single points of failure.
How Availability Sets Work
When you create an Availability Set and then deploy virtual machines into it, Azure automatically distributes these VMs across the different Update Domains and Fault Domains. This distribution ensures that:
- No two VMs in the same Availability Set share the same underlying hardware rack.
- Each VM is placed in a different Fault Domain.
- VMs are spread across multiple Update Domains.
Creating an Availability Set
You can create an Availability Set through the Azure portal, Azure CLI, or Azure PowerShell. When creating it, you typically specify:
- Subscription: The Azure subscription to use.
- Resource Group: The resource group to contain the Availability Set.
- Name: A unique name for the Availability Set.
- Region: The Azure region where the Availability Set will be deployed.
- Fault Domains: The number of Fault Domains to use (e.g., 2 or 3).
- Update Domains: The number of Update Domains to use (e.g., 5 or more).
Example using Azure CLI:
az vm availability-set create \
--resource-group myResourceGroup \
--name myAvailabilitySet \
--location eastus \
--platform-fault-domain-count 3 \
--platform-update-domain-count 5
Deploying VMs to an Availability Set
Once an Availability Set is created, you can deploy new virtual machines directly into it. You select the Availability Set when configuring the virtual machine in the Azure portal or by specifying its ID in scripts.
Managing Availability Sets
After deployment, you can monitor the status of your Availability Set and the VMs within it through the Azure portal. This includes information about which Fault Domain and Update Domain each VM is assigned to.
Limitations and Considerations
- Availability Sets are designed for VMs deployed within a single datacenter. For multi-datacenter redundancy, consider using Availability Zones or Disaster Recovery solutions.
- Availability Sets apply to the underlying infrastructure. They do not inherently provide application-level fault tolerance. You still need to design your applications for resilience.
- The maximum number of FDs and UDs can vary by region and subscription type.
Next Steps
To learn more about ensuring application availability in Azure, consider exploring: