GCP Price List API

947 views
Skip to first unread message

Eik Lin Wong

unread,
Oct 23, 2018, 4:26:19 AM10/23/18
to gce-discussion
Hi,

Is it possible to derive the compute engine standard machine types from the JSON results of the GCP Price List API?


Rahi (Google Cloud Support)

unread,
Oct 23, 2018, 12:52:29 PM10/23/18
to gce-discussion
Hi Eik,

You can try this pagination format (https://cloudbilling.googleapis.com/v1/services/<<service_id>>/skus?key=<<API_key>>) or can use Cloud Billing Catalog API to retrieve the machine type information from the JSON while using Cloud Billing API. You can view the complete pricing through the Pricing SKU page.

I quickly tested while using curl as below and ran at the cloud shell. I was able to see the standard machine types at the JSON returned. 

$ curl https://cloudbilling.googleapis.com/v1/services/<<service_id>>/skus?key=<<API_key>>

You can find information about using API Key on this page. I was able to see the Machine Type into the "description" field at the JSON which comes right after "skuId" filed. You can use the pipe (grep) into to curl command in case if you want to filter specific machine type.

Eik Lin Wong

unread,
Oct 25, 2018, 11:23:50 AM10/25/18
to gce-discussion
Hi,

But the description field is not complete. Moreover the JSON does not state the number of memory and cpu. I need to be able to script this to retrieve the configuration and the price programmatically to aid our work.

I have previously done some work for AWS price list API and the JSON was pretty comprehensive. Hope to be able to achieve something similar for GCP to eliminate manual look-up of the configuration and pricing table.

Germán (Google Cloud Support)

unread,
Oct 26, 2018, 5:30:08 PM10/26/18
to gce-discussion

I tried running the command

‘curl https://cloudbilling.googleapis.com/v1/services/<<service_id>>/skus?key=<<API_key>>’ and for as a result the description for one of my machines ‘description": "Preemptible Highmem Intel N1 64 VCPU running in Montreal’


The  ‘N1 64’ if cross referenced with this document [1] you will see the equivalent CPU core count and Ram


[1]https://cloud.google.com/compute/docs/machine-types#standard_machine_types


Eik Lin Wong

unread,
Oct 30, 2018, 1:33:23 AM10/30/18
to gce-discussion
Hi I need to do that programmatically, so ideally it should all be referenced in the json.

Yui (Google Cloud Support)

unread,
Oct 31, 2018, 1:00:12 PM10/31/18
to gce-discussion
If the description field is not complete or lack information, we might need to proceed with a feature request. That being said, you may also have a look at this documentation in order to manage your billing, where you can export your JSON file to BigQuery for analysis. I believe data that you are inquiring will be displayed at labels on your BigQuery dataset which will show you machine type, vCPUs and memory.
Reply all
Reply to author
Forward
0 new messages