Skip to content

Budget

Source: src/AWS/Budgets/Budget.ts

An AWS Budget — tracks cost or usage against a defined limit over a time period and notifies subscribers when configured thresholds are crossed.

Budgets are a global (account-level) resource; they are free and take effect immediately.

Monthly cost budget with an email alert at 80%

import * as Budgets from "alchemy/AWS/Budgets";
const budget = yield* Budgets.Budget("MonthlyCost", {
budgetType: "COST",
timeUnit: "MONTHLY",
budgetLimit: { amount: "100", unit: "USD" },
notifications: [
{
notificationType: "ACTUAL",
comparisonOperator: "GREATER_THAN",
threshold: 80,
thresholdType: "PERCENTAGE",
subscribers: [{ subscriptionType: "EMAIL", address: "team@example.com" }],
},
],
});

Budget scoped to a single service

const budget = yield* Budgets.Budget("EC2Spend", {
budgetLimit: { amount: "500", unit: "USD" },
costFilters: {
Service: ["Amazon Elastic Compute Cloud - Compute"],
},
});