Azure Reservations vs Automated Power Downs
Two of the biggest techniques for saving money on Azure Virtual Machines are Reservations and shutting down VMs when they are not in use. However, as they can’t be used together which one is best?
Azure Reservations allow you to rent those VMs for a much cheaper price, but there’s a commitment of 1 or 3 years. One alternative, automated power-down, involves automatically turning VMs on and off based on their usage requirements. For example a service might only need to be available in office hours or Monday-Friday so why leave the server powered on over night when no-one is using it?
Why can’t they be used together? Well, technically they can- but probably it won’t save you any money. An Azure Reservation commits you to paying a (reduced) price for a VM whether or not that VM is powered on, so if you power down that VM with a reservation you’re still paying (unless you have another un-reserved VM of the same size which is on).
This means there are situations when a reservation is cheaper, and situations when not buying reservations and running the power control automation is financially preferable.
Here’s an example. The pricing is from the Azure Pricing Calculator in January 2021 using the UK South region, and may not represent current rates in your chosen Region.
A Linux D2v3 VM is required Monday-Friday 9am-5pm all year round. Uptime in the non-reserved scenario is 8 hours/day or 40 hours/week.
So if our VM costs £0.0865 per hour we are charged (£0.0865 x 40=) £3.46 per week, an average of £15.32 for a 31 day month.
If the VM was left on 24/7 on Pay-As-You-Go pricing that would be (£0.0865 x 24 x 7=) £14.532 per week or £54.356 per month.
Uptime in the reserved scenario is always 24 hours/day
- With a 1 year reservation the VM has a 37% discount, so the cost is (£14.532 x 0.63=) £9.15 per week or £40 per month
- With a 3 year reservation the VM has a 57% discount, so the cost is (£14.532 x 0.43=) £6.25 per week or £27.10 per month
To put that all in a table:
|Hours||Cost / month|
|24/7 Pay As You Go||£63.14|
|24/7 Reserved Instance 1 year||£40.00|
|24/7 Reserved Instance 3 year||£27.10|
|Mon-Fri 9-5: 40 hours per week||£15.32|
|Mon-Sun 8-6: 70 hours per week||£26.82|
|Mon-Fri 24/5: 120 hours per week||£45.97|
If a server needs to be on over 70 hours a week then switching to a 3-year reserved instance that’s on 24/7 becomes cheaper to run. The 1-year reservation becomes the cheaper option at 105 hours per week (e.g. 5am-8pm 7 days a week).
I’ve used an Ubuntu Linux VM in the previous example, and for Windows VMs with Hybrid Benefits applied the pricing is the same. Without Hybrid Benefits, where you are paying for the Windows license with the VM the calculations are trickier because the license isn’t subject to the Reserved Instance discount. Using a figure of £50.00 per month our table now looks like this:
|Hours||Cost / month|
|24/7 Pay As You Go||£113.14|
|24/7 Reserved Instance 1 year||£90.00|
|24/7 Reserved Instance 3 year||£77.10|
|Mon-Fri 9-5: 40 hours per week||£26.94|
|Mon-Sun 8-6: 70 hours per week||£47.14|
|Mon-Fri 24/5: 120 hours per week||£80.81|
With the Windows license included, that tipping point changes to 115 hours if you’re using the 3-year, or 134 hours if you’re using the 1-year.
At this juncture I should point out that these discounts vary between VM sizes and regions. Sticking in UK South the 1-year reservation is hits 55% for the DS2v2 instance, and 70% for the 3-year option. That D2v3 used in our example pricing which is discounted at 37%/57% in UK South is cut by 42%/63% in Switzerland North. Of course, all the base prices vary between instance size and region too- so it’s worth running the calculations on your real environment.
Of course there are other factors to take into account when using either method. Reserved Instances are tying you into a period of use on that family of VM so you should be right-sized before signing up and confident that the application is going to outlast the length of the agreement in this state, or if not you will be able to utilise a VM of that size elsewhere in your environment.
On the flip-side there is a certain amount of overhead setting up and maintaining scheduled startup/ shutdown of Virtual Machines, and any experienced IT person will be placing bets on how long it takes for a customer to report that they couldn’t log on to that VM at 11pm on Sunday!
Remember, you can use the Azure Pricing Calculator to work out specific scenarios.