google-cloud-platformgoogle-compute-enginegoogle-compute-api

GCP Committed Usage Discount(CUD) Utilization REST API


I have a commitment created in GCP cloud for a reservation. The commitment includes a VM e2-micro and a single virtual CPU with 1024MB memory. I am trying to get a utilization of this resource till date. Unfortunately I could not a single REST API that gives me the data I am looking for. Eg(total reserved hours, used hours, on demand cost, net savings and utilization percentage. AWS has a nice SDK boto3 that we can use to call get_reservation_utilization API from CE service but for GCP I don't seem to find any.

Is there any such API exists?

Thanks.

What I've tried so far,

  1. Tried monitoring service to get the metrics for reserved and used hours of reservation but that's doesn't give me the values I was looking for.

Solution

  • There is no feature available directly in GCP. To get the detailed CUD utilization data e.g. total reserved hours, used hours on demand cost and net savings, there’s no direct REST API for that.

    There isn’t a direct API for it but you can combine different tools and sources of information to approximate the CUD utilization including using cloud billing API, monitoring API among others.

    Consider submitting a feature request to google cloud to add a dedicated CUD utilization API.

    It is a feature request so you can open a new Public Issue Tracker report with the description of your issue and the steps to reproduce it.

    Refer to this official documents for more information Spend-based committed use discounts , Committed use discount and Resource-based committed use discounts