Firebase is now making cloud function only for blaze plan. The problem is there is no budget limit.. only budget notifications ! i've heard it can be done with a script like pub/sub when notification of budget is received , the app engine is disabled ? is it really possible doing this ?
1 Answers
Yes, you can set up budget notifications and use them as triggers to Cloud Functions in order to disable certain API or resources when your defined budget threeshold is reached.
To that effect you could follow the setps outlined in "set budget" documentation that explains how to set the notifications and then follow this doc about how to make these notifications to create a Pub/Sub event. Afterwards you'll need to create a Cloud Function to handle such events in the way you feel more appropiate, some examples could be found here.
On top of that, some API offer the possibility to cap it's usage as explained here. This might allow to set API limits so to stay below the free usage quotas or restrict how much usage could the API get before it starts rejecting requests.
Keep in mind that if you shutdown resources such as VM instances they won't be recoverable so read carefully the documentation of whatever API or resource you're trying to control to avoid unexpected outcomes.

- 1,962
- 1
- 6
- 13