1
+ {
2
+ "Resources" : {
3
+ "inAlarmLambdaServiceRole970DE64C" : {
4
+ "Type" : " AWS::IAM::Role" ,
5
+ "Properties" : {
6
+ "AssumeRolePolicyDocument" : {
7
+ "Statement" : [
8
+ {
9
+ "Action" : " sts:AssumeRole" ,
10
+ "Effect" : " Allow" ,
11
+ "Principal" : {
12
+ "Service" : " lambda.amazonaws.com"
13
+ }
14
+ }
15
+ ],
16
+ "Version" : " 2012-10-17"
17
+ },
18
+ "ManagedPolicyArns" : [
19
+ {
20
+ "Fn::Join" : [
21
+ " " ,
22
+ [
23
+ " arn:" ,
24
+ {
25
+ "Ref" : " AWS::Partition"
26
+ },
27
+ " :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
28
+ ]
29
+ ]
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ "inAlarmLambda0920D101" : {
35
+ "Type" : " AWS::Lambda::Function" ,
36
+ "Properties" : {
37
+ "Code" : {
38
+ "ZipFile" : " \n def handler(event, context):\n make this fn fail\n prinr22(''hello)"
39
+ },
40
+ "FunctionName" : " inAlarmLambda" ,
41
+ "Handler" : " index.handler" ,
42
+ "Role" : {
43
+ "Fn::GetAtt" : [
44
+ " inAlarmLambdaServiceRole970DE64C" ,
45
+ " Arn"
46
+ ]
47
+ },
48
+ "Runtime" : " python3.12"
49
+ },
50
+ "DependsOn" : [
51
+ " inAlarmLambdaServiceRole970DE64C"
52
+ ]
53
+ },
54
+ "Alarm7103F465" : {
55
+ "Type" : " AWS::CloudWatch::Alarm" ,
56
+ "Properties" : {
57
+ "ActionsEnabled" : true ,
58
+ "AlarmActions" : [
59
+ {
60
+ "Ref" : " alarmLambdaCurrentVersionBDCE825Ced84cae8d64e7eaa69f8105fc0363a2a"
61
+ },
62
+ {
63
+ "Ref" : " alarmLambdaAliasaliasName41B27313"
64
+ },
65
+ {
66
+ "Fn::GetAtt" : [
67
+ " alarmLambda131DB691" ,
68
+ " Arn"
69
+ ]
70
+ }
71
+ ],
72
+ "ComparisonOperator" : " GreaterThanThreshold" ,
73
+ "Dimensions" : [
74
+ {
75
+ "Name" : " FunctionName" ,
76
+ "Value" : {
77
+ "Ref" : " inAlarmLambda0920D101"
78
+ }
79
+ }
80
+ ],
81
+ "EvaluationPeriods" : 1 ,
82
+ "MetricName" : " Errors" ,
83
+ "Namespace" : " AWS/Lambda" ,
84
+ "Period" : 60 ,
85
+ "Statistic" : " Sum" ,
86
+ "Threshold" : 1 ,
87
+ "TreatMissingData" : " notBreaching"
88
+ }
89
+ },
90
+ "AlarmCurrentVersionAlarmPermission22DB4772" : {
91
+ "Type" : " AWS::Lambda::Permission" ,
92
+ "Properties" : {
93
+ "Action" : " lambda:InvokeFunction" ,
94
+ "FunctionName" : {
95
+ "Fn::Join" : [
96
+ " " ,
97
+ [
98
+ {
99
+ "Ref" : " alarmLambda131DB691"
100
+ },
101
+ " :" ,
102
+ {
103
+ "Fn::GetAtt" : [
104
+ " alarmLambdaCurrentVersionBDCE825Ced84cae8d64e7eaa69f8105fc0363a2a" ,
105
+ " Version"
106
+ ]
107
+ }
108
+ ]
109
+ ]
110
+ },
111
+ "Principal" : " lambda.alarms.cloudwatch.amazonaws.com" ,
112
+ "SourceAccount" : {
113
+ "Ref" : " AWS::AccountId"
114
+ },
115
+ "SourceArn" : {
116
+ "Fn::GetAtt" : [
117
+ " Alarm7103F465" ,
118
+ " Arn"
119
+ ]
120
+ }
121
+ }
122
+ },
123
+ "AlarmAliasaliasNameAlarmPermission3887D390" : {
124
+ "Type" : " AWS::Lambda::Permission" ,
125
+ "Properties" : {
126
+ "Action" : " lambda:InvokeFunction" ,
127
+ "FunctionName" : {
128
+ "Fn::Join" : [
129
+ " " ,
130
+ [
131
+ {
132
+ "Fn::Select" : [
133
+ 6 ,
134
+ {
135
+ "Fn::Split" : [
136
+ " :" ,
137
+ {
138
+ "Ref" : " alarmLambdaAliasaliasName41B27313"
139
+ }
140
+ ]
141
+ }
142
+ ]
143
+ },
144
+ " :aliasName"
145
+ ]
146
+ ]
147
+ },
148
+ "Principal" : " lambda.alarms.cloudwatch.amazonaws.com" ,
149
+ "SourceAccount" : {
150
+ "Ref" : " AWS::AccountId"
151
+ },
152
+ "SourceArn" : {
153
+ "Fn::GetAtt" : [
154
+ " Alarm7103F465" ,
155
+ " Arn"
156
+ ]
157
+ }
158
+ }
159
+ },
160
+ "AlarmalarmLambdaAlarmPermission5CAF3DE7" : {
161
+ "Type" : " AWS::Lambda::Permission" ,
162
+ "Properties" : {
163
+ "Action" : " lambda:InvokeFunction" ,
164
+ "FunctionName" : {
165
+ "Ref" : " alarmLambda131DB691"
166
+ },
167
+ "Principal" : " lambda.alarms.cloudwatch.amazonaws.com" ,
168
+ "SourceAccount" : {
169
+ "Ref" : " AWS::AccountId"
170
+ },
171
+ "SourceArn" : {
172
+ "Fn::GetAtt" : [
173
+ " Alarm7103F465" ,
174
+ " Arn"
175
+ ]
176
+ }
177
+ }
178
+ },
179
+ "alarmLambdaServiceRoleCDAABB9D" : {
180
+ "Type" : " AWS::IAM::Role" ,
181
+ "Properties" : {
182
+ "AssumeRolePolicyDocument" : {
183
+ "Statement" : [
184
+ {
185
+ "Action" : " sts:AssumeRole" ,
186
+ "Effect" : " Allow" ,
187
+ "Principal" : {
188
+ "Service" : " lambda.amazonaws.com"
189
+ }
190
+ }
191
+ ],
192
+ "Version" : " 2012-10-17"
193
+ },
194
+ "ManagedPolicyArns" : [
195
+ {
196
+ "Fn::Join" : [
197
+ " " ,
198
+ [
199
+ " arn:" ,
200
+ {
201
+ "Ref" : " AWS::Partition"
202
+ },
203
+ " :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
204
+ ]
205
+ ]
206
+ }
207
+ ]
208
+ }
209
+ },
210
+ "alarmLambda131DB691" : {
211
+ "Type" : " AWS::Lambda::Function" ,
212
+ "Properties" : {
213
+ "Code" : {
214
+ "ZipFile" : " \n def handler(event, context):\n print('event:', event)\n print('.............................................')\n print('context:', context)"
215
+ },
216
+ "FunctionName" : " alarmLambda" ,
217
+ "Handler" : " index.handler" ,
218
+ "Role" : {
219
+ "Fn::GetAtt" : [
220
+ " alarmLambdaServiceRoleCDAABB9D" ,
221
+ " Arn"
222
+ ]
223
+ },
224
+ "Runtime" : " python3.12"
225
+ },
226
+ "DependsOn" : [
227
+ " alarmLambdaServiceRoleCDAABB9D"
228
+ ]
229
+ },
230
+ "alarmLambdaCurrentVersionBDCE825Ced84cae8d64e7eaa69f8105fc0363a2a" : {
231
+ "Type" : " AWS::Lambda::Version" ,
232
+ "Properties" : {
233
+ "FunctionName" : {
234
+ "Ref" : " alarmLambda131DB691"
235
+ }
236
+ }
237
+ },
238
+ "alarmLambdaAliasaliasName41B27313" : {
239
+ "Type" : " AWS::Lambda::Alias" ,
240
+ "Properties" : {
241
+ "FunctionName" : {
242
+ "Ref" : " alarmLambda131DB691"
243
+ },
244
+ "FunctionVersion" : {
245
+ "Fn::GetAtt" : [
246
+ " alarmLambdaCurrentVersionBDCE825Ced84cae8d64e7eaa69f8105fc0363a2a" ,
247
+ " Version"
248
+ ]
249
+ },
250
+ "Name" : " aliasName"
251
+ }
252
+ }
253
+ },
254
+ "Parameters" : {
255
+ "BootstrapVersion" : {
256
+ "Type" : " AWS::SSM::Parameter::Value<String>" ,
257
+ "Default" : " /cdk-bootstrap/hnb659fds/version" ,
258
+ "Description" : " Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
259
+ }
260
+ },
261
+ "Rules" : {
262
+ "CheckBootstrapVersion" : {
263
+ "Assertions" : [
264
+ {
265
+ "Assert" : {
266
+ "Fn::Not" : [
267
+ {
268
+ "Fn::Contains" : [
269
+ [
270
+ " 1" ,
271
+ " 2" ,
272
+ " 3" ,
273
+ " 4" ,
274
+ " 5"
275
+ ],
276
+ {
277
+ "Ref" : " BootstrapVersion"
278
+ }
279
+ ]
280
+ }
281
+ ]
282
+ },
283
+ "AssertDescription" : " CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
284
+ }
285
+ ]
286
+ }
287
+ }
288
+ }
0 commit comments