This message was deleted.
# general
b
This message was deleted.
b
seems like you are using the graphql interface to get the price, the prices array consist of multiple resource based pricing, like one can be storage cost, other vm cost etc
can you share the query you are trying or terraform file ?
f
Copy code
{
  "query": "{ products(filter: {vendorName: \"azure\",region: \"westus\", service: \"Virtual Machines\", attributeFilters: [{key :\"armSkuName\" , value : \"Standard_M128m\"}]}) { attributes { key, value } prices  { USD } } } "
}
b
Copy code
these seems to 3 different compute sizes
your query is matching three computes sizes
M128m Spot
M128m Low Priority
M128m (Standard)
you can change your query to look for specific skuName or preferably meterName
armSkuName are same for all three
👍 2
f
I tried this query {"query": "{ products(filter: {vendorName: \"azure\",region: \"westus\", service: \"Virtual Machines\", attributeFilters: [{key :\"skuName\" , value : \"M128m\"}]}) { attributes { key, value } prices { USD } } } " } and got { "data": { "products": [ { "attributes": [ { "key": "meterId", "value": "871771b5-dd37-59ed-aa19-b367d7db8823" }, { "key": "skuName", "value": "M128m" }, { "key": "meterName", "value": "M128m" }, { "key": "productId", "value": "DZH318Z0BQ4W" }, { "key": "serviceId", "value": "DZH313Z7MMC8" }, { "key": "armSkuName", "value": "Standard_M128m" }, { "key": "productName", "value": "Virtual Machines MS Series" }, { "key": "serviceFamily", "value": "Compute" }, { "key": "effectiveStartDate", "value": "2020-07-01T000000Z" } ], "prices": [ { "USD": "255081" }, { "USD": "34.694" }, { "USD": "174777" } ] }, { "attributes": [ { "key": "meterId", "value": "074ab99b-0be2-53d4-9aa1-5b6c6678537f" }, { "key": "skuName", "value": "M128m" }, { "key": "meterName", "value": "M128m" }, { "key": "productId", "value": "DZH318Z0BPW5" }, { "key": "serviceId", "value": "DZH313Z7MMC8" }, { "key": "armSkuName", "value": "Standard_M128m" }, { "key": "productName", "value": "Virtual Machines MS Series Windows" }, { "key": "serviceFamily", "value": "Compute" }, { "key": "effectiveStartDate", "value": "2021-02-01T000000Z" } ], "prices": [ { "USD": "40.582" }, { "USD": "34.694" } ] } ] } } I got products this time second one is fine , but first one is still confusing ,as it have array of 3 values [ 255081 , 34.694 , 174777 ] . Iam sure about the middle price is of linux , but the first and third one is confusing , what this first and third price represents ?
b
Copy code
# Write your query or mutation here
query {
  products(
    filter: {
      vendorName: "azure",
      service: "Virtual Machines",
      region: "westus",
 				attributeFilters: [
          {key: "meterName", value: "M128m"},
          {key: "armSkuName", value: "Standard_M128m"},

      ]
    },
  ) {
    prices(
      filter: {
				purchaseOption: "Consumption",
      },
    ) { USD,
      purchaseOption
      startUsageAmount
    unit}
  }
}
try this one
here price is associated with Reservation of 1 and 3 years (255081, 174777), i guess you are looking for consumption so u can try above query
🙌 1
Copy code
{
  "data": {
    "products": [
      {
        "prices": [
          {
            "USD": "34.694",
            "purchaseOption": "Consumption",
            "startUsageAmount": "0",
            "unit": "1 Hour"
          }
        ]
      },
      {
        "prices": [
          {
            "USD": "40.582",
            "purchaseOption": "Consumption",
            "startUsageAmount": "0",
            "unit": "1 Hour"
          }
        ]
      }
    ]
  }
}
👍 2