In this article I want to talk about how Azure Spot Instances can save you money on your Virtual Machines. These virtual machines are categorized as Infrastructure as a Service (IaaS).
I recently received a new subscription and had to rebuild my infrastructure from scratch. At the moment I have four Active Directory Domain Controllers, a server running Azure AD Connect to sync my identities to Azure AD and a management server where I complete all my management tasks.
I prefer to run my Domain Controllers and Azure AD Connect server 24/7. I have had issues in the past with Active Directory when all my Domain Controllers are shut down and not running. Mostly I experience issues with DFRS in terms of the SYSVOL replication requiring me to complete an authoritative restore to remediate DFSR replication.
I don’t have many changes that requires the Azure AD Connect server to run permanently but I prefer to keep this server online to prevent sync health errors.
Not to mention Update Management, MDI, Security Events and more that effectively stops when these servers are offline. Effectively, I want to run my lab servers as much as long as possible with as little cost as necessary.
New VM using Spot Instance
Let’s build a new virtual machine in Azure using Spot Instance. To be clear, I won’t complete the build but will demonstrate the pricing option when selecting Azure Spot during the initial settings.
My first step would be to build a new VM
I am not going into details around the options to create a VM. Let’s look at the Azure Spot setting
I am selecting Capacity only which means it would only trigger when there isn’t any excess capacity in Azure. I also select Stop / Deallocate which means the machine would be deallocated and can be started up again later when needed.
Let’s select the sizing which would show us the actual pricing for each VM type. Not all VM sizes are available for the Azure Spot discount.
Select See all sizes from the Size selection.
For this demonstration I don’t want to group by series. You may want to do this if you are looking for a particular VM size. I just want to group the VM’s by pricing, not considering the type of VM.
I also change the cost display from hourly to monthly. When creating a VM without Spot Instance, the costs are displayed for monthly pricing and not hourly, so I am changing this to do the pricing comparison.
In this instance, the D2s_v4 VM is the least expensive. Eviction rate should be low as it indicates how often your VM could be evicted, meaning deallocated. My machines are running in West Europe, pricing may differ between regions. Cost is shown in Dollar, this VM would be $13,05 per month.
New VM without Spot Instance
I will select the same image which is the Operating System and then review the pricing of the VM sizes without using Spot Instance. We need to compare the pricing of the D2s_v4 VM.
Again, I don’t have grouping of VM sizes and sort according to cost. Cost filter is set to monthly by default. I can now see that the same VM without the Spot Instance option would cost me $151.11 per month. Quite a price difference compared to the Spot Instance.
The D2s_v4 machine has 2 vCPU’s and 8GB RAM. The closest machine in terms of pricing when not using Spot Instance is the B1s which has 1 vCPU and 1GB RAM. For almost the same price you can create a VM with 2 vCPU’s and 8GB RAM.
Review the options available when using Spot Instances. Yes, your VM’s may be deallocated unexpectedly but you can save a lot of money running your lab, using higher specification servers for the same price. The options are available to run your lab with the least amount of cost based on your needs.