Little Math: When to purchase Azure instance reservation
Azure offers instance reservation for 1 or for 3 years with a great discount that you shouldn’t miss.
PAY as You Go prices is good for short term, spiky usage, while reservation is fit for long term 7×24 hours running virtual machines.
What is the challenge that who has solid view what will happen in 3 years, meaning application architecture unchanged, capacity will be only increasing, etc.
It is better as it seems, about 1.5-2 years forecast is enough, let us see the details.
Firstly, let me highlight that only the 7×24 running instances are worth to reserve. If VM can be shut down during night or for the weekends, it can be 70% cost saving without reservation, never forget.
Back to reservation, let us calculate the total cost of ownership comparing options for
- Pay as you go prices
- 1 year reservation iteratively
- 1 year reservation and pay as you go
- 3 years reservation
Below chart shows the TCO for each month in case of a D16s v3 CentOS/Ubuntu instance located in East US.
The dashed red line shows the lowest TCO.
Typically, the VM lifespan can be estimated only with likelihood. There is a possible pitfall here, that VM is reserved for 1 year and after 12 months it is reserved for additional 1 year which is the same cost as it would have been reserved for 3 years originally.
Similarly, there is a risk that after 19 months the instance is not decommissioned as a project may be delayed or whatever reason. Therefore, it could be considered to reserve the instance for 3 years if the instance is expected to be running for more than 14 months where 3 years reservation TCO is smaller than PAYGO.
The reservation rule depends on how long the instance possible to be running:
- Less than 7 months, keep it with PAYGO
- Running between 7 – 14 months, reserve for 1 year and keep PAYGO
- Running more than 14 months, reserve for 3 years.
The 7,14 and 19 “magic numbers” varies on the instance type prices, practically depends on the RI discounts, easily calculated with the formulas below.
Risk can be handled by having a “portfolio”, keeping x% of the instances with 3 years reservation while let other fraction reserving for 1 year and the remaining for PAYGO.