0
0
Azurecloud~30 mins

Right-sizing resources in Azure - Mini Project: Build & Apply

Choose your learning style9 modes available
Right-sizing Azure Virtual Machines
📖 Scenario: You are managing cloud costs for a small company using Azure. You want to analyze the current virtual machines (VMs) and decide which ones can be resized to save money without affecting performance.
🎯 Goal: Build a simple Azure resource configuration that lists VMs with their current sizes and CPU usage, then mark which VMs should be resized based on a CPU usage threshold.
📋 What You'll Learn
Create a dictionary with VM names as keys and their current sizes as values
Add a dictionary with VM CPU usage percentages
Write logic to identify VMs with CPU usage below a threshold (30%)
Add a final dictionary marking VMs recommended for resizing
💡 Why This Matters
🌍 Real World
Cloud administrators often need to analyze VM usage to reduce costs by resizing underused resources.
💼 Career
This project teaches skills useful for cloud cost optimization roles and Azure infrastructure management.
Progress0 / 4 steps
1
Create VM size dictionary
Create a dictionary called vm_sizes with these exact entries: 'vm1': 'Standard_D2s_v3', 'vm2': 'Standard_B1ms', 'vm3': 'Standard_D4s_v3'
Azure
Need a hint?

Use curly braces to create a dictionary with the exact VM names and sizes.

2
Add VM CPU usage dictionary
Create a dictionary called vm_cpu_usage with these exact entries: 'vm1': 25, 'vm2': 55, 'vm3': 15
Azure
Need a hint?

Create a dictionary with VM names as keys and CPU usage as integer values.

3
Set CPU usage threshold and identify low usage VMs
Create a variable called cpu_threshold and set it to 30. Then create a list called low_usage_vms that contains VM names from vm_cpu_usage where the CPU usage is less than cpu_threshold using a list comprehension.
Azure
Need a hint?

Use a list comprehension to filter VMs with CPU usage less than the threshold.

4
Create resize recommendation dictionary
Create a dictionary called resize_recommendations where keys are VM names from vm_sizes and values are true if the VM is in low_usage_vms, otherwise false. Use a dictionary comprehension.
Azure
Need a hint?

Use a dictionary comprehension to assign true or false based on membership in low_usage_vms.