Learn this information to learn to scale an Azure Spot discounted VM up or down (vertical resize).
Overview of Azure Spot VMs
When deploying an Azure VM, you could possibly use Azure Spot. This lets you set the hourly value you need to pay.
Azure Spot provides this selection if it has capability, however when the capability is required or the worth adjustments as a consequence of demand, the VM will both be stopped/deallocated or deleted, relying on the choice you selected whenever you arrange the Azure Spot low cost.
If you happen to attempt resizing the VM after creating it, you might not be capable to as a result of the utmost value you set for the VM is decrease than the worth of the brand new dimension.
On this state of affairs, you should enhance the utmost value you’re keen to pay for the Azure Spot VM. Within the remaining a part of this information, I’ll stroll you thru the steps to cease/deallocate, enhance the utmost value supply, and resize it.
Step 1: Get a Quote for the New VM SKU
- Open the VM you need to resize, broaden its Availability + scale blade, and navigate to Dimension. After that, choose a brand new dimension for the VM and select Resize.
- The operation ought to throw an error, together with the minimal value it is best to set. Within the screenshot beneath, I’ve highlighted the quote (0.04116) I used to be provided.
If the Resize button is grayed out after deciding on any out there sizes, you will have run out of the Spot low cost for that dimension. See step 2 beneath for find out how to proceed.
- Scroll down, broaden the Inadequate quota – spot restrict part, and click on the Request quota subsequent to one of many out there VM SKUs.
- Then, on the New Quota Request fly-out window, settle for the really useful quota restrict or enter one other worth, and click on Submit.
If the request fails, open a help ticket.
Step 2: Cease (Deallocate) the VM
You can’t modify the utmost value supply of an Azure Spot discounted VM whereas it’s working. So, step one is to cease the VM with the steps beneath:
- Click on the VM’s Overview blade, click on Cease, and make sure the operation.
- Affirm that the VM has stopped by clicking the notification icon on the highest menu.
Step 3: Enhance the Azure Spot VM’s Most Worth
Now that you’ve stopped the VM, you may enhance the utmost value you need to pay to the worth you obtain in Step 1 by working the next PowerShell instructions.
Run the command by way of Azure Cloud Shell PowerShell.
#1: Get the VM settings
$VM = Get-AzVM -ResourceGroup "<ResourceGroupName>" -Title "VM title>"#2: Set a brand new Azure Spot most value
#Microsoft provided me 0.04116. I set my value at 0.0412 so mine supply is barely above the quoteReplace-AzVM -ResourceGroupName "<ResourceGroupName>" -VM $VM -MaxPrice <New most value>
#3: Lastly, begin the VM
Begin-AzVM -ResourceGroupName "<ResourceGroupName>" -Title "VM title>"
Here’s a screenshot of the above instructions in my Azure Cloud Shell.
Step 4: Scale Up or Down (Resize) the VM
Return to the VM’s Availability + scale > Dimension blade, choose the brand new dimension (SKU), and select Resize.
Monitor the progress of the resize operation by way of the notification window.
Conclusion
Azure Spot is nice for creating discounted VMs for lab and take a look at environments. Nevertheless, resizing the VM is hard due to the utmost supply value you set whenever you created the Spot VM.
The trick is to cease the VM, replace the supply most value, after which resize the VM.
I defined the steps for finishing these duties on this fast information, and I hope you discovered it helpful. Let me know your ideas by responding to our “Was this web page useful?” suggestions request beneath.