Trigger for budgets
Written by
Triggers for budgets launch a function in Cloud Functions or a container in Serverless Containers when threshold values are exceeded.
Roles required for the proper operation of a trigger for budgets
- To create a trigger, you need a permission for a service account that runs the trigger executing the operation. This permission is included in the roles iam.serviceAccounts.user, editor, and higher.
- For a trigger to work, the service account needs:
serverless.functions.invoker
for the function that the trigger invokes.serverless.containers.invoker
for the container that the trigger invokes.viewer
for the cloud that the billing account is linked to.
Format of the message from the trigger for budgets
After the trigger is activated, it sends the following message to the function or the container:
{
"messages":[
{
"billing_account_id":"a6q6***",
"budget_id":"a626***",
"budget_display_name":"name",
"amount":90012.00,
"currency":"RUB",
"period":"2021",
"budgeted_amount":100000.00,
"threshold_amount":90000.00,
"threshold_type":"amount"
}
]
}
Where:
billing_account_id
: Billing account ID.budget_id
: Budget ID.budget_display_name
: Budget name.amount
: The cost of resources or account balance when notifications were triggered.currency
: Payment currency.period
: Budget tracking period.budgeted_amount
: Budget amount.threshold_amount
: Consumption threshold that triggered notifications.threshold_type
: Threshold type:amount
: Currency.percent
: Percentage.