@@ -15,7 +15,7 @@ Tags used for budget filters must be activated as Cost Allocation Tags in your a
15
15
Budget notifications are sent via Amazon SNS, which can be configured for the following delivery methods:
16
16
- ** Email** : Each email address must confirm the notification opt-in the first time it is deployed.
17
17
- ** 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) .
19
19
20
20
Below is an example of creating a budget for resources tagged with ` Owner: backend ` . Notifications will be sent to a
21
21
specified 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.
41
41
},
42
42
amount: 100 ,
43
43
subscribers: {
44
- slack: slackBudgetNotifications ,
44
+ slack: [ slackBudgetNotifications ] ,
45
45
46
46
},
47
47
},
@@ -71,7 +71,7 @@ specified Slack channel and email address once the budget exceeds $100.
71
71
},
72
72
" amount" : 100 ,
73
73
" subscribers" : {
74
- " slack " : slack_budget_notifications,
74
+ " slacks " : [ slack_budget_notifications] ,
75
75
76
76
},
77
77
},
@@ -82,6 +82,71 @@ specified Slack channel and email address once the budget exceeds $100.
82
82
</Fragment >
83
83
</DualCode >
84
84
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
+
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
+
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
+
85
150
## Defaults
86
151
87
152
The construct provides two default budgets available via ` Defaults.budgets ` . These include:
0 commit comments