简体   繁体   中英

Get Azure VM price from Java SDK

I need to know Azure VM price and size in my Java application.

using java sdk I could get a VM size

List<VirtualMachine> vms = 
azure.virtualMachines().listByResourceGroup(resourceGroup);
for (VirtualMachine vm : vms)
{
    vm.size(); // returns "Standard_D4_v3"
    vm.osType(); // returns "Linux"
}

Now I want to search for VM price.

Using Azure public API

" https://azure.microsoft.com/api/v2/pricing/virtual-machines-base/calculator "

I could search for VM price, but VM naming in calculator differs.

In calculator it will be named as "linux-d4v3-standard".

So, how could I compare VM in Java SDK to VM's in calculator API?

"Standard_D4_v3" and "Linux" to "linux-d4v3-standard"

Is it a way to get VM price from java SDK (I'm talking about abstract VMs that are not created yet, we want to calculate VMs price before VMs creation on our side)

Thank you.

Azure pricing is dynamic, and it changes frequently. Prices also differ by market and currency. The Azure rate card takes these facts into consideration and predicts the monthly bill for the partner and customers.

Not sure, but you can take a look at this . You can obtain the Azure rate card through function IPartner.getRateCards().getAzure in Java SDK. Maybe it can help you. If you need more help please give me the message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM