How to Resize an Azure Spot Discounted VM

How to Resize an Azure Spot Discounted VM Leave a comment

Read this information to learn the way to scale an Azure Spot discounted VM up or down (vertical resize).

Overview of Azure Spot VMs

When deploying an Azure VM, you could give you the chance to use Azure Spot. This permits you to set the hourly worth you need to pay.

Azure Spot gives this selection if it has capability, however when the capability is required or the worth modifications due to demand, the VM will both be stopped/deallocated or deleted, relying on the choice you selected if you arrange the Azure Spot low cost.

If you strive resizing the VM after creating it, you might not be in a position to as a result of the utmost worth you set for the VM is decrease than the worth of the brand new dimension.

In this example, you have to improve the utmost worth you’re prepared to pay for the Azure Spot VM. In the remaining a part of this information, I’ll stroll you thru the steps to cease/deallocate, improve the utmost worth provide, and resize it.

Step 1: Get a Quote for the New VM SKU

  1. Open the VM you need to resize, increase its Availability + scale blade, and navigate to Size. After that, choose a brand new dimension for the VM and select Resize.
  2. The operation ought to throw an error, together with the minimal worth it’s best to set. In the screenshot under, 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’ve gotten run out of the Spot low cost for that dimension. See step 2 under for a way to proceed.

Open the VM you want to resize, expand its Availability + scale blade, and navigate to Size. After that, select a new size for the VM and choose Resize.
  1. Scroll down, increase the Insufficient quota – spot restrict part, and click on the Request quota subsequent to one of many out there VM SKUs.
Scroll down, expand the Insufficient quota - spot limit section, and click the Request quota next to one of the available VM SKUs.
  1. Then, on the New Quota Request fly-out window, settle for the really helpful quota restrict or enter one other worth, and click on Submit.

If the request fails, open a assist ticket.

Step 2: Stop (Deallocate) the VM

You can’t modify the utmost worth provide of an Azure Spot discounted VM whereas it’s operating. So, step one is to cease the VM with the steps under:

  1. Click the VM’s Overview blade, click on Stop, and ensure the operation.
  1. Confirm that the VM has stopped by clicking the notification icon on the highest menu.
Confirm that the VM has stopped by clicking the notification icon on the top menu.

Step 3: Increase the Azure Spot VM’s Maximum Price

Now that you’ve stopped the VM, you’ll be able to improve the utmost worth you need to pay to the worth you obtain in Step 1 by operating the next EnergyShell instructions.

Run the command by way of Azure Cloud Shell EnergyShell.

#1: Get the VM settings
$VM = Get-AzVM -ResourceGroup "<ResourceGroupName>" -Name "VM name>"

#2: Set a brand new Azure Spot most worth
#Microsoft provided me 0.04116. I set my worth at 0.0412 so mine provide is barely above the quote

Update-AzVM -ResourceGroupName "<ResourceGroupName>" -VM $VM -MaxPrice <New most worth>

#3: Finally, begin the VM

Start-AzVM -ResourceGroupName "<ResourceGroupName>" -Name "VM name>"

Here is a screenshot of the above instructions in my Azure Cloud Shell.

 Increase the Azure Spot VM's Maximum Price

Step 4: Scale Up or Down (Resize) the VM

Return to the VM’s Availability + scale > Size blade, choose the brand new dimension (SKU), and select Resize.

Monitor the progress of the resize operation by way of the notification window.

Monitor the progress of the resize operation via the notification window.

Conclusion

Azure Spot is nice for creating discounted VMs for lab and take a look at environments. However, resizing the VM is difficult due to the utmost provide worth you set if you created the Spot VM.

The trick is to cease the VM, replace the provide most worth, 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 page helpful?” suggestions request under.

Leave a Reply