Given an Azure VM size as string (e.g. "STANDARD_A4_v2") I would like to programmatically infer available memory and number of vCPUs. I've looked through azure-mgmt-compute but can't find what I'm looking for. I saw this post using a ComputeManagementClient to iterate over all available VM sizes, but that's not what I need and furthermore in my case I only have access to Azure Batch credentials. Do I have to role my own (at least for vCPUs) following the naming conventions?
Many thanks,
Andreas
The issue that you have seen is what you need. The virtual_machine_sizes
only have one function and it's the list
. So you need to find your real VM size in the list. For example:
compute_client = CompteManagementClient(credentials, subscription_id)
vmSizes = compute_client.virtual_machine_sizes.list(location)
for vmSize in vmSizes:
if(vmSize.name == "STANDARD_A4_v2")
print("number of vCPU: " + vmSize.number_of_cores)
print("available memory: " + vmSize.memory_in_mb)
And naming conventions are the rules that how does Azure define the VM size. You just need to read it to understand the VM size.