Installation
Step-by-step installation instructions.
Installing this extension is made to be as simple as possible. However, due to Firebase Extensions limitations, there are some post installation steps you must undertake. Below is a step-by-step guide from start to finish in how to get this extension up and running. I have also included brief clips showcasing what each step looks like for those that are more visual!
You are good to go!
Feel free to test the extension and ensure it is working correctly. See Testing this Extension below.
Configurable Parameters
During the extension installation, you will be asked to configure it with the following parameters:
TOPIC_NAME
The name of the pub/sub topic. A billing alert is published here, which will trigger the auto-stop (if the threshold is reached).
ext-firebase-trigger-auto-stop
BUDGET_STOP_THRESHOLD_PERCENT
The percentage (0.0-1.0) of the budget that will trigger the stop strategy, default is 1.0 (100%)
1.0
DISABLE_BILLING
Enables strategy 1 - to remove the billing account (requires project billing manager
role)
Yes (true)
DISABLE_API_LIST
Enables strategy 2 - to disable services (requires service usage admin
role).
[Empty]
LOCATION
Defines the deployment location for the cloud function.
us-central1
Example Pub/Sub Message
When a budget alert fires, the message content will look like the below:
{
"budgetDisplayName": "Your Budget Name",
"alertThresholdExceeded": 0.5,
"costAmount": 500.0,
"costIntervalStart": "2021-01-01T00:00:00Z",
"budgetAmount": 1000.0,
"budgetAmountType": "SPECIFIED_AMOUNT",
"currencyCode": "USD",
"schemaVersion": "1.0",
"notificationType": "ACTUAL",
"projectId": "your-project-id",
"billingAccountId": "012345-6789AB-CDEF01"
}
The key element of this message is the alertThresholdExceeded
, all other information is effectively discarded.
Testing this Extension
Once you have followed the steps, you can submit a message through the pub/sub topic. Any results will be published as logs, which you can monitor.
This example message will not execute any strategy.
{
"extensionTest": true
}
Example Log
Below is the log output when sending the test message. Note that this specific example is for Strategy 1 only which requires the Project Billing Manager role, while the Service Usage Admin role is not required.

Last updated