0
0
Azurecloud~30 mins

Azure Spot VMs for cost savings - Mini Project: Build & Apply

Choose your learning style9 modes available
Azure Spot VMs for cost savings
📖 Scenario: You are managing cloud resources for a small company. You want to save money by using Azure Spot Virtual Machines (VMs), which are cheaper but can be evicted when Azure needs capacity.You will create an Azure VM configuration that uses Spot VMs to reduce costs while maintaining basic settings.
🎯 Goal: Build an Azure VM configuration that uses Spot VMs with eviction policy set to Deallocate and a maximum price set to 50% of the pay-as-you-go price.
📋 What You'll Learn
Create a basic Azure VM configuration dictionary
Add a configuration variable to enable Spot VM with eviction policy
Apply the Spot VM settings in the VM configuration
Complete the VM configuration with the maximum price and eviction policy
💡 Why This Matters
🌍 Real World
Using Azure Spot VMs helps companies save money by running workloads on cheaper, interruptible virtual machines.
💼 Career
Cloud engineers and architects often configure Spot VMs to optimize cloud costs while managing workload availability.
Progress0 / 4 steps
1
Create the initial VM configuration dictionary
Create a dictionary called vm_config with these exact entries: 'name': 'myVM', 'location': 'eastus', and 'vm_size': 'Standard_DS1_v2'.
Azure
Need a hint?

Use a Python dictionary with keys 'name', 'location', and 'vm_size' and assign the exact values.

2
Add Spot VM configuration variable
Create a variable called spot_config as a dictionary with 'eviction_policy': 'Deallocate' and 'max_price': -1.
Azure
Need a hint?

Use a dictionary with keys 'eviction_policy' and 'max_price'. Use -1 for max_price to indicate the default maximum price.

3
Apply Spot VM settings to the VM configuration
Add a key 'priority' with value 'Spot' and a key 'spot_config' with the variable spot_config inside the vm_config dictionary.
Azure
Need a hint?

Assign the string 'Spot' to the 'priority' key and assign the variable spot_config to the 'spot_config' key inside vm_config.

4
Set maximum price for Spot VM and finalize configuration
Change the 'max_price' in spot_config to 0.5 to set the maximum price to 50% of pay-as-you-go price.
Azure
Need a hint?

Update the 'max_price' key in spot_config dictionary to 0.5.