How do I get Google Cloud costs for this month programmatically? - google-cloud-platform

My current Google Cloud billing dashboard shows me the charges for this month, for all my Google Services: Storage, BigQuery, etc.
How do I get this information programmatically? The Cloud Billing API only gives me billing details, but that is not what I want.
I also tried looking into Google Storage for the billing file they periodically update, but it contains information for 2 days ago only.
What should I do?

If you enable 'Billing Export' in the 'Billing' tab, a new JSON or CSV file will be exported everyday into Google Cloud Storage. It will have that days' usage and cost information. I have files there since the beginning of my project.

Related

BigQuery data transfer service for Google Play specific App data

Can Google BigQuery data transfer service allow me to transfer specific app data automatically?
For example, I have 10 apps in my Google play console, I only want to transfer to BQ within only 3 apps. Is it possible to make this work or any approach?
Also, I just read the price of doc, The monthly charge is $25 per unique Package Name in the Installs_country table.
I don't quite understand how to calculate my cost with that example.
Thank you.
For your requirement, you can download the reports in Cloud Storage of a specific app by selecting the app from Google Play Store for which you want to get the data and then send it to BigQuery using BigQuery Data Transfer Service. The cost calculation of Google Play, it is calculated as $25 per month per unique package and stored in the Installs_country table in BigQuery.
For selecting the specific app, follow the steps given below :
Go to the Play Console.
Click on Download Reports and select the type of report you want.
Under "Select an application," type and select the app for which you want to get the data.
Select the year and month for which you want to download the report.
If you are storing data in a Cloud Storage bucket then that will incur cost and the pricing for data transfer from one storage bucket to another storage bucket can be checked in this link and since you are storing and querying in BigQuery that will also be chargeable.For BigQuery pricing details you can check this documentation. You can use the Billing Calculator to calculate your costs.

Pricing on google calendar API quota increase

My google calendar usage already exceeded the "Queries per minute" quota, which is 10,000. And my application hits 20,000 requests per minute for the moment, so I'm expecting to increase the quota to 200,000. When I tried to do it I was asked to create a billing account, which I'm going to do, but I need to know the pricing before that.
Despite my effort I was unable to find the exact information on pricing. Please help me understand the pricing involved with increasing the quotas of google calendar API.
To give more information about the application, this is a backup application where we backup all the Google workspace data including the calendar events using service accounts. So all the payment for calendar service will be done by my company.
Thank you.

How to know if how many node hours I have used on a Google Cloud ML for prediction?

I tried to find out how to get the node hour usage of my Google Cloud ML Prediction API, but didn't find any. Is there a way to know the usage, except for looking at the bills?
Here is the API Documentation I referred to.
The documentation page you referenced is part of the Cloud Machine Learning Engine API documentation:
An API to enable creating and using machine learning models.
That API is for using the product itself, it doesn't contain billing information for the product.
For billing info you want to look at Cloud Billing and its API:
With this API, you can do any of the following.
For billing accounts:
...
Get billing information for a project.
However from just a quick glance at the docs (I didn't use it yet) the API itself doesn't appear to directly provide the particular info you're looking for. But possible ways to get that info appear to be:
using Billing Reports:
The Cloud Billing Reports page lets you view your Google Cloud
Platform (GCP) usage costs at a glance and discover and analyze
trends. The Reports page displays a chart that plots usage costs for
all projects linked to a billing account. To help you view the cost
trends that are important to you, you can select a data range, specify
a time range, configure the chart filters, and group by project,
product, or SKU.
Billing reports can help you answer questions like these:
How is my current month's GCP spending trending?
Export Billing Data to a File:
To access a detailed breakdown of your charges, you can export your
daily usage and cost estimates automatically to a CSV or JSON file
stored in a Google Cloud Storage bucket you specify. You can then
access the data via the Cloud Storage API, CLI tool, or Google Cloud
Platform Console.
Export Billing Data to BigQuery:
Billing export to BigQuery enables you to export your daily usage and
cost estimates automatically throughout the day to a BigQuery dataset
you specify. You can then access your billing data from BigQuery. You
can also use this export method to export data to a JSON file.

Google Cloud Storage network usage

I am using GCS to store images for my Android application.
I was searching the Google Cloud Platform console, but haven't found network usage or something that will show me how many people uploaded/downloaded how many files/bytes of data. They tell you how they calculate the price, using network and class a/b operations, but i don't find the place to track this data myself.
You have to export these logs to bigquery. You can't find them in GCP interface
Storage logs are generated once a day and contain the storage usage for the previous day. They are typically created before 10:00 am PST.
Usage logs are generated hourly when there is activity to report in the monitored bucket. Usage logs are typically created 15 minutes after the end of the hour.
https://cloud.google.com/storage/docs/access-logs

How often does GCP update the billing charges shown on GCP console? Is it real time?

How often does Google cloud platform update (refresh) the billing charges shown on GCP console? Is there a fixed delay or is it real-time?
The billed charges are updated daily and the invoice is generated monthly. One can also check usage on demand programmatically, follow the instrucions -> https://cloudplatform.googleblog.com/2017/11/monitor-and-manage-your-costs-with.html