问题
I'd like to make sure I don't spend too much money in GCP (Google Cloud Platform) usage, but I'm not sure of the way to do so, if such a way exist.
So I tried creating budgets in GCP, but I doubt these are hard cap, since the documentation and this question (though asking about google developer console, therefore my question isn't, I think, a duplicate) seem to suggest Google budgets are simply sending notification, but don't put hard cap on your GCP usage.
Thank you for your help.
回答1:
It is possible to cap costs and stop usage for a Google Cloud project. You need to
- setup up a budget to monitor project costs,
- enable budget notifications
- and then configure a Cloud Function to call the Cloud Billing API that disables billing for the project as described in GCP documentation.
回答2:
You can set a limit for App Engine resources [1] and a limit for API calls [2] (as stated by @jonatjano). For everything else notifications are the only way to go.
You can set a daily spending limits only for your App Engine resources that are running in the standard environment.
Note: The spending limit does not apply to other Google Cloud Platform resources and you will be charged for their usage. Also, spending limits might be exceeded slightly while your application is disabled.
回答3:
There isnt ~currently~ a way to centrally cap spending on most of the functionality in GCP - its been mentioned a few times on https://googlecloudplatform.uservoice.com/ and they do seem to be putting some work in on this side of things.
You can get alerted via this though https://cloud.google.com/billing/docs/how-to/budgets
来源:https://stackoverflow.com/questions/51889969/can-i-set-a-hard-limit-to-google-cloud-platform-spend-if-yes-how