@@ -15,7 +15,7 @@ Tags used for budget filters must be activated as Cost Allocation Tags in your a
1515Budget notifications are sent via Amazon SNS, which can be configured for the following delivery methods:
1616- ** Email** : Each email address must confirm the notification opt-in the first time it is deployed.
1717- ** Slack** : Notifications are sent to a designated Slack channel. The Slack workspace must be linked to the Management
18- Account. For setup details, see the SOP [ AWS Chatbot and Slack Integration] ( sop- account-setup#aws-chatbot-and-slack-integration ) .
18+ Account. For setup details, see the SOP [ AWS Chatbot and Slack Integration] ( / sop/ account-setup#aws-chatbot-and-slack-integration) .
1919
2020Below is an example of creating a budget for resources tagged with ` Owner: backend ` . Notifications will be sent to a
2121specified Slack channel and email address once the budget exceeds $100.
@@ -41,7 +41,7 @@ specified Slack channel and email address once the budget exceeds $100.
4141 },
4242 amount: 100 ,
4343 subscribers: {
44- slack: slackBudgetNotifications ,
44+ slack: [ slackBudgetNotifications ] ,
4545 emails: [' you@org.com' ],
4646 },
4747 },
@@ -71,7 +71,7 @@ specified Slack channel and email address once the budget exceeds $100.
7171 },
7272 " amount" : 100 ,
7373 " subscribers" : {
74- " slack " : slack_budget_notifications,
74+ " slacks " : [ slack_budget_notifications] ,
7575 " emails" : [" you@org.com" ],
7676 },
7777 },
@@ -82,6 +82,71 @@ specified Slack channel and email address once the budget exceeds $100.
8282 </Fragment >
8383</DualCode >
8484
85+ ## Reusing the same SNS Topic
86+
87+ Each budget creates a unique SNS topic with the name ` ${budget.name}-topic ` . If multiple budgets share the same
88+ subscribers, you can use a single SNS topic to reduce the number of resources and subscription confirmations.
89+ To do this, set the ` snsTopicName ` property in ` BudgetSubscribers ` . For example:
90+
91+ <DualCode >
92+ <Fragment slot = " ts" >
93+ ``` ts {5}
94+ import {App } from ' aws-cdk-lib' ;
95+ import { DataLandingZone , SlackChannel } from ' aws-data-landing-zone' ;
96+
97+ const subscribers: BudgetSubscribers = {
98+ snsTopicName: ' budgets' ,
99+ slacks: [{
100+ slackChannelConfigurationName: ' budget-alerts' ,
101+ slackWorkspaceId: ' YourWorkspaceId' ,
102+ slackChannelId: ' YourChannelId' ,
103+ }],
104+ emails: [" you@org.com" ],
105+ };
106+
107+ const app = new App ();
108+ const dlz = new DataLandingZone (app , {
109+ budgets: [
110+ ... Defaults .budgets (100 , 20 , subscribers ),
111+ { name: ' budget-high' , amount: 1_000 , subscribers },
112+ { name: ' budget-high-1' , amount: 2_000 , subscribers },
113+ ],
114+ ...
115+ });
116+ ```
117+ </Fragment >
118+ <Fragment slot = " python" >
119+ ``` python {5}
120+ import aws_cdk as cdk
121+ import aws_data_landing_zone as dlz
122+
123+ budget_subscribers = dlz.BudgetSubscribers(
124+ sns_topic_name = " budgets" ,
125+ slacks = [
126+ dlz.SlackChannel(
127+ slack_channel_configuration_name = " budget-alerts" ,
128+ slack_workspace_id = " YourWorkspaceId" ,
129+ slack_channel_id = " YourChannelId" ,
130+ )
131+ ],
132+ emails = [
133+ " you@org.com" ,
134+ ]
135+ )
136+
137+ app = cdk.App()
138+ dlz.DataLandingZone(app,
139+ budgets = [
140+ * dlz.Defaults.budgets(org_total = 500 , infra_dlz = 20 , subscribers = budget_subscribers),
141+ dlz.DlzBudgetProps(name = " budget-high" , amount = 1_000 , subscribers = budget_subscribers),
142+ dlz.DlzBudgetProps(name = " budget-high-1" , amount = 2_000 , subscribers = budget_subscribers)
143+ ],
144+ ...
145+ )
146+ ```
147+ </Fragment >
148+ </DualCode >
149+
85150## Defaults
86151
87152The construct provides two default budgets available via ` Defaults.budgets ` . These include:
0 commit comments