Skip to content

DescribeBudget

Source: src/AWS/Budgets/DescribeBudget.ts

Runtime binding for budgets:ViewBudget via DescribeBudget.

Bind this operation to a Budget to read its definition and — most usefully at runtime — its CalculatedSpend (actual and forecasted spend so far in the period), e.g. for a cost kill-switch or a spend dashboard. Provide the implementation with Effect.provide(AWS.Budgets.DescribeBudgetHttp).

// init — bind the operation to the budget
const describeBudget = yield* AWS.Budgets.DescribeBudget(budget);
// runtime
const { Budget: b } = yield* describeBudget();
const actual = Number(b?.CalculatedSpend?.ActualSpend?.Amount ?? "0");
const limit = Number(b?.BudgetLimit?.Amount ?? "0");
const overBudget = limit > 0 && actual >= limit;