google-cloud-platformgoogle-compute-enginegoogle-cloud-sdk

GCP : Identify correct instance(N1standard 8, N1Highmem etc.) using catlog API


We are currently working on GCP pricing module and for that we are using GCP catalog API to get the pricing for various GCP services.

While analyzing the response of catalog api for Compute Engine, we observed that there is no any exact parameter in the sku object with which we could identify the machine type(N1Standard 4, NIHighmem 16 etc.) except description.

Other than parsing the description, is there any workaround to directly get the sku object with particular number of cores?

Is there any workaround to directly get the sku object for particular instance name?

for example : N1Standard 16 Following is sample sku object for N1Highcpu with 8 cores where the number of cores are only mentioned in description.:

{
      "name": "services/<<id>>/skus/C216-207D-0521",
      "skuId": "C216-207D-0521",
      "description": "Highcpu Intel N1 8 VCPU running in Netherlands",
      "category": {
        "serviceDisplayName": "Compute Engine",
        "resourceFamily": "Compute",
        "resourceGroup": "N1Highcpu",
        "usageType": "OnDemand"
      },
      "serviceRegions": [
        "europe-west4"
      ],
      "pricingInfo": [
        {
          "summary": "",
          "pricingExpression": {
            "usageUnit": "h",
            "usageUnitDescription": "hour",
            "baseUnit": "s",
            "baseUnitDescription": "second",
            "baseUnitConversionFactor": 3600,
            "displayQuantity": 1,
            "tieredRates": [
              {
                "startUsageAmount": 0,
                "unitPrice": {
                  "currencyCode": "USD",
                  "units": "0",
                  "nanos": 312400000
                }
              }
            ]
          },
          "currencyConversionRate": 1,
          "effectiveTime": "2018-05-17T08:22:54.236Z"
        }
      ],
      "serviceProviderName": "Google"
    }

Solution

  • The features you need have not been implemented yet on the Cloud Billing Catalog API.

    As for the moment the only workaround would be parsing the output to get the SKU for the Compute Engine instances. So, please follow up the feature request here.