Skip to content

Budgets

AWS Budgets provides tools to monitor and control costs by setting custom spending thresholds. You can create monthly budgets, specifying the budget amount and filtering resources based on their tags.

Budget notifications are sent via Amazon SNS, which can be configured for the following delivery methods:

  • Email: Each email address must confirm the notification opt-in the first time it is deployed.
  • Slack: Notifications are sent to a designated Slack channel. The Slack workspace must be linked to the Management Account. For setup details, see the SOP AWS Chatbot and Slack Integration.

Below is an example of creating a budget for resources tagged with Owner: backend. Notifications will be sent to a specified Slack channel and email address once the budget exceeds $100.

import {App} from 'aws-cdk-lib';
import { DataLandingZone, SlackChannel } from 'aws-data-landing-zone';
const slackBudgetNotifications: SlackChannel = {
slackChannelConfigurationName: 'budget-alerts',
slackWorkspaceId: 'YourWorkspaceId:',
slackChannelId: 'YourChannelId',
};
const app = new App();
const dlz = new DataLandingZone(app, {
budgets: [
{
name: 'backend',
forTags: {
owner: 'backend',
},
amount: 100,
subscribers: {
slack: slackBudgetNotifications,
emails: ['[email protected]'],
},
},
],
...
});

Defaults

The construct provides two default budgets available via Defaults.budgets. These include:

  • Organizational Budget: Covers all resources across all AWS accounts.
  • DLZ Resources Budget: Tracks resources created by DLZ, filtered by the tags Owner: 'infra' and Project: 'dlz'.

The example below demonstrates creating a $100 budget for the entire organization and a $20 budget for DLZ-managed resources. Notifications are sent to the specified Slack channel and email address.

import {App} from 'aws-cdk-lib';
import { DataLandingZone, SlackChannel } from 'aws-data-landing-zone';
const slackBudgetNotifications: SlackChannel = {
slackChannelConfigurationName: 'budget-alerts',
slackWorkspaceId: 'YourWorkspaceId:',
slackChannelId: 'YourChannelId',
};
const app = new App();
const dlz = new DataLandingZone(app, {
budgets: [
...Defaults.budgets(100, 20, {
slack: slackBudgetNotifications,
emails: ['[email protected]'],
}),
],
...
});

API References