In the past week we saw the release to public preview of on-demand capacity reservations for Azure virtual machines. This is not to be confused with reserved instances which are a way of committing to paying for compute services for 1 or 3 years and by doing so receiving a discount on the pay as you go pricing.
Instead, on-demand capacity reservations are a way you can block off (reserve) Azure compute resources for your use only. I think of it almost like renting your own private section in a datacentre only it’s limited to vCPU cores and RAM rather than physical space.
Why would you need to do this?
Azure does not have an unlimited amount of resources. It may seem like that sometimes but there’s only so much compute power that can physically fit into a Microsoft datacentre. This is why Microsoft are constantly adding more datacentres and more Azure regions, to keep up with increasing demand and add better service availability options.
Those datacentres are used for a lot of different Microsoft services besides Azure such as Microsoft 365 hosting, Xbox, LinkedIn etc and even Sony are planning to move their Playstation gaming services to Azure. That’s a lot of compute power and Microsoft has to manage its resource availability very carefully.
Many customers experienced resource allocation issues during the early days of the Covid-19 pandemic in 2020 as there was a surge of customers rapidly deploying virtual machines in Azure over a very short period of time. The point is, extra resources are not guaranteed to be made available to most customers.
If you have an upcoming migration project or are expecting to need to scale out your environment then you may want to consider pre-booking those compute resources beforehand to guarantee availability just in case.
I’ve already deployed what I need, so do I need to read any further?
What about guaranteeing availability of that production environment? Maybe you need to take it offline for maintenance from time to time or perform disaster recovery drills. Is there a chance you won’t get access to those compute resources again?
What about your disaster recovery site hosted in another Azure region? You are likely expecting to be able to failover your virtual machines if and when needed but what if there aren’t enough resources available? I have often wondered what would happen if an entire Azure region went down and then there was a scramble for capacity in the paired region when customers invoke their DR plans. Will there be enough capacity for everyone????
This is where on-demand capacity reservations come in. Once this feature goes into general availability you can expect a service SLA (yet to be published) which will outline just what Microsoft are prepared to guarantee in terms of resource availability. Otherwise, for most customers at least, it is first come first served in terms of who gets access to those compute resources.
The cost of an on-demand capacity reservation is the same cost that you would expect to pay for an instance of that virtual machine size in that Azure region. So for example, if you wanted to reserve capacity for an E4s v3 virtual machine in North Europe, you would pay the same price as the pay as you go compute cost for that virtual machine. It’s only compute capacity that is being reserved so no need to worry about licensing or storage costs here.
Once you deploy a matching virtual machine into that capacity reservation the compute cost has already been covered so you don’t get charged twice.
Important to note that there is no commitment period with on-demand capacity reservations. You are charged by the minute for the reservation but you can delete this at any time if no longer required.
What if I have reserved instances in place?
The good news is that you can still use reserved instances to discount your pricing. So for example if you wanted to reserve capacity for a number of virtual machines in a DR site then you could also purchase reserved instances to reduce the price on those capacity reservations. Even if there are no actual virtual machines deployed the discounted pricing will apply to the on-demand reservation capacity cost.
How to add an on-demand capacity reservation
Whilst in preview you will have to first register this feature with the Microsoft.Compute resource provider.
Register-AzProviderFeature -FeatureName CapacityReservationPreview -ProviderNamespace Microsoft.Compute
Once that step is completed we start by creating a capacity reservation group. This is simply a collection of capacity reservations that you intend to use that will be scoped to a single Azure region.
Note, you can optionally scope the capacity reservations to particular availability zones where available.
Then you just add the reservations that you require for that region, i.e. the quantity of each VM size that you require.
Remember, once the capacity reservations are created you will be charged for those reservations even if you don’t have any matching virtual machines associated to use those capacity reservations.
How do I associate virtual machines?
Once you provision a virtual machine that matches the size and region of your capacity reservation you must also assign the virtual machine to the capacity reservation group that you created. This can be done at the time of deployment or at a later stage when the virtual machine is deallocated. You will find this setting in the advanced section of the virtual machine creation wizard or in the configuration settings of the virtual machine after it is deployed.
At this point you can monitor if you have any virtual machines associated to your capacity reservation group and check if they have been allocated to a reservation.
It is also possible to overallocate instances so for example I have two capacity reservations set aside for my domain controller virtual machines. I can add a third DC virtual machine and associate it with the capacity reservation group. This won’t guarantee my resource allocation unless I either purchase another capacity reservation or else deallocate one of my already allocated virtual machines.
My first thoughts about on-demand capacity reservations
I think the concept is definitely a good one and it will be interesting to see just what the service SLA provides, i.e. how guaranteed is the availability. I work with a lot of customers in the SMB space and I don’t generally see them going for this service outside of usage for critical infrastructure. I believe DR site reserved capacity is the most likely use case for enterprise customers however.
In terms of what I have found with my testing there were some issues here. I had some errors with trying to disassociate virtual machines from the capacity reservation group both with the portal and with PowerShell. I also found the portal would often not correctly reflect the number of allocated virtual machines I had when I was adding and removing virtual machines in the group.
I think there needs to be a better monitoring mechanism in place to determine if the reservation is actually allocated to a virtual machine as I did not have confidence in what the portal was reporting. This will be very important as if the capacity reservation is not allocated correctly then not only would you not get the SLA guarantee from using the service but you would also be charged twice for the compute cost of the virtual machine instance!