Are your cloud computing costs going out of control? Microsoft Azure has different methods of payment for your infrastructure-as-a-service (VMs) and other resources. In this article, we will focus on how you can reduce Azure VM costs significantly using reserved instances and flexibility groups. The reserved instances feature is not for everyone. It is recommended for those organizations that can sustain the usage of VMs for a one- or three-year commitment, where three years has more savings.
An essential point that is critical to understand is that it is not required to be the same VMs. The cloud administrator must keep in mind that this means committing to paying for a VM for all available hours from the time you create the reserved instance over the next one or three years. So, if you can stop the VM from 8 p.m.-6 a.m. and spin another VM with the same size in that period, you won’t pay extra. After all, you already paid for those hours of that VM. Actually, this idea applies to its VM family, and we will cover this in the next section.
If you are a small shop with 10 VMs that you are planning to remove half in a few months, stay low for another period: The reserved instance may not be for you. To get the most advantage of the cost savings, you must make sure that you can use the reserved instances resources at all times.
The key point when using reserved instances is that you are committing to pay for the compute time for one or three years, and by doing that, you can reduce Azure costs up 72 percent (that is right!) compared with pay-as-you-go (the default method).
We can simulate and compare price variation between one- and three-year commitments, pay as you go, and spot. Click here to go to the web page depicted in the image below, and we can play around with several payment options, including Azure hybrid benefits.
Understanding flexibility groups
The flexibility group was introduced in August 2018 and automatically applied to all VMs that share the same flexibility group within the same Azure region. As a customer, you do not need to configure anything on your subscription, but understanding the feature plays a key role when designing your Azure environment, especially in dynamic IT environments.
Instead of creating a bunch of reserved instances for every single VM type, as long as we keep the same family we can scale down and add more servers without incurring extra costs. After all, we already paid for those hours (please, don’t forget that!). In the past, we would have to exchange or cancel an existing reserved instance when choosing a different VM type, and it is no longer the case.
The flexibility group feature applies to all reserved instances, even for those purchased before the feature was introduced.
We can start using the scenario of the ESv3 Series family, and the family has several VM sizes for all requirements. In the screenshot below, we have added a couple of VM sizes available with their CPU, memory, and data disks for comparison.
There is also a ratio (the red box) for each VM size, and that ratio is defined at the VM size level. The ratio is vital when purchasing reserved instances.
It is easier to understand running a simple (well, not so simple, scenario). Let’s say that we have a dynamic company, and all the activities that we are going to describe here will happen in a single day between 6 a.m.-9 p.m. (15 hours).
Before starting our busy day in our shop, we have purchased two reserved instances of an E32s_v3 (32 CPU, 256GB RAM, 32 data disks and ratio 16), which means that our baseline is 32 (2 servers x 16 ratio).
At 6 a.m., the business wants to bring it up App1 (APP1-SRV01 and APP-SRV02), and they are going to use the VM size E32s_v3. Great! We are covered, and we don’t need to pay any additional cost to run those VMs. Right now, each E32s VM has a ratio of 16, so we are using 32.
At 10 a.m., the App2 team requires four E16s_v3 to be running (APP2-SRV01, SRV02, SRV03, and SRV04). Right now, we are using four servers x 8 (E16 ratio) = 32, plus the 32 coming from the existent VMs E32s that are still running. We have to pay on-demand costs for those four VMs that ran during this hour.
At 11 a.m., the App1 team decided that the application is faulty, and they are stopping the VMs until further notice. Great! Not having those two VMs, our utilization came back to 32, and we are flying under the radar again.
At 6 p.m., the team wants to bring down two E16s_v3 servers, which will reduce to 16. At the same time, they want to bring it up to four E8s_v3 servers (each server has a ratio of 4). We are back to 32, but now running six servers.
The chaotic day can be seen in the image below. The only additional cost is those four servers at 10 a.m. because the 32 was already in use when we started the new set of servers, and they will be charged on-demand basis.
From 19 p.m. to 21 p.m., we lost money — we paid already for VMs running and we haven’t run anything.
Before the flexibility group, a different type of VM wouldn’t be covered by a reserved instance, and there would be an additional cost. Nowadays, since they are part of the family, the reserved instance is shared among them, creating automatic savings.
You may have a nagging question popping up in your head, which is how do I know the ratio and flexibility family of any given VM, am I right? Especially because that information is not being provided in the Azure Portal.
Help from Microsoft
There is no magic. The Microsoft Azure Team created a spreadsheet in a public Storage Account with that information. You can download the CSV file here. The file is a CSV nowadays, and they are planning to release an API to allow the customers to retrieve that information as well.
The file is simple, and it has the flexibility group in the first column, the VM sizes on the second column, and the ratio in the third and last column.
Now you know how to reduce Azure costs
In this article, we covered how to reduce Azure costs and the benefits of having flexibility groups with reserved instances in Microsoft Azure through examples and a farfetched scenario to see how the feature applies in a dynamic environment.
Featured image: Shutterstock