@aws-solutions-constructs/aws-lambda-kinesisstreams 2.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/.eslintignore +5 -0
  2. package/.jsii +3655 -0
  3. package/README.md +121 -0
  4. package/architecture.png +0 -0
  5. package/lib/index.d.ts +90 -0
  6. package/lib/index.js +64 -0
  7. package/package.json +92 -0
  8. package/test/integ.existingLambda.d.ts +13 -0
  9. package/test/integ.existingLambda.expected.json +232 -0
  10. package/test/integ.existingLambda.js +31 -0
  11. package/test/integ.existingStream.d.ts +13 -0
  12. package/test/integ.existingStream.expected.json +231 -0
  13. package/test/integ.existingStream.js +37 -0
  14. package/test/integ.existingStreamWithCmk.d.ts +13 -0
  15. package/test/integ.existingStreamWithCmk.expected.json +300 -0
  16. package/test/integ.existingStreamWithCmk.js +39 -0
  17. package/test/integ.existingVpc.d.ts +13 -0
  18. package/test/integ.existingVpc.expected.json +1068 -0
  19. package/test/integ.existingVpc.js +34 -0
  20. package/test/integ.newStreamFromProps.d.ts +13 -0
  21. package/test/integ.newStreamFromProps.expected.json +231 -0
  22. package/test/integ.newStreamFromProps.js +34 -0
  23. package/test/integ.newVpc.d.ts +13 -0
  24. package/test/integ.newVpc.expected.json +674 -0
  25. package/test/integ.newVpc.js +31 -0
  26. package/test/integ.newVpcFromProps.d.ts +13 -0
  27. package/test/integ.newVpcFromProps.expected.json +560 -0
  28. package/test/integ.newVpcFromProps.js +34 -0
  29. package/test/integ.noArguments.d.ts +13 -0
  30. package/test/integ.noArguments.expected.json +232 -0
  31. package/test/integ.noArguments.js +30 -0
  32. package/test/lambda/index.mjs +15 -0
  33. package/test/lambda-kinesisstream.test.d.ts +13 -0
  34. package/test/lambda-kinesisstream.test.js +472 -0
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
5
+ * with the License. A copy of the License is located at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
10
+ * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
13
+ export {};
@@ -0,0 +1,231 @@
1
+ {
2
+ "Resources": {
3
+ "teststream04374A09": {
4
+ "Type": "AWS::Kinesis::Stream",
5
+ "Properties": {
6
+ "RetentionPeriodHours": 24,
7
+ "StreamEncryption": {
8
+ "EncryptionType": "KMS",
9
+ "KeyId": "alias/aws/kinesis"
10
+ },
11
+ "StreamModeDetails": {
12
+ "StreamMode": "ON_DEMAND"
13
+ }
14
+ }
15
+ },
16
+ "testlambdakinesisstreamsLambdaFunctionServiceRole95206CF3": {
17
+ "Type": "AWS::IAM::Role",
18
+ "Properties": {
19
+ "AssumeRolePolicyDocument": {
20
+ "Statement": [
21
+ {
22
+ "Action": "sts:AssumeRole",
23
+ "Effect": "Allow",
24
+ "Principal": {
25
+ "Service": "lambda.amazonaws.com"
26
+ }
27
+ }
28
+ ],
29
+ "Version": "2012-10-17"
30
+ },
31
+ "Policies": [
32
+ {
33
+ "PolicyDocument": {
34
+ "Statement": [
35
+ {
36
+ "Action": [
37
+ "logs:CreateLogGroup",
38
+ "logs:CreateLogStream",
39
+ "logs:PutLogEvents"
40
+ ],
41
+ "Effect": "Allow",
42
+ "Resource": {
43
+ "Fn::Join": [
44
+ "",
45
+ [
46
+ "arn:",
47
+ {
48
+ "Ref": "AWS::Partition"
49
+ },
50
+ ":logs:",
51
+ {
52
+ "Ref": "AWS::Region"
53
+ },
54
+ ":",
55
+ {
56
+ "Ref": "AWS::AccountId"
57
+ },
58
+ ":log-group:/aws/lambda/*"
59
+ ]
60
+ ]
61
+ }
62
+ }
63
+ ],
64
+ "Version": "2012-10-17"
65
+ },
66
+ "PolicyName": "LambdaFunctionServiceRolePolicy"
67
+ }
68
+ ]
69
+ }
70
+ },
71
+ "testlambdakinesisstreamsLambdaFunctionServiceRoleDefaultPolicyED972043": {
72
+ "Type": "AWS::IAM::Policy",
73
+ "Properties": {
74
+ "PolicyDocument": {
75
+ "Statement": [
76
+ {
77
+ "Action": [
78
+ "xray:PutTraceSegments",
79
+ "xray:PutTelemetryRecords"
80
+ ],
81
+ "Effect": "Allow",
82
+ "Resource": "*"
83
+ },
84
+ {
85
+ "Action": [
86
+ "kinesis:ListShards",
87
+ "kinesis:PutRecord",
88
+ "kinesis:PutRecords"
89
+ ],
90
+ "Effect": "Allow",
91
+ "Resource": {
92
+ "Fn::GetAtt": [
93
+ "teststream04374A09",
94
+ "Arn"
95
+ ]
96
+ }
97
+ }
98
+ ],
99
+ "Version": "2012-10-17"
100
+ },
101
+ "PolicyName": "testlambdakinesisstreamsLambdaFunctionServiceRoleDefaultPolicyED972043",
102
+ "Roles": [
103
+ {
104
+ "Ref": "testlambdakinesisstreamsLambdaFunctionServiceRole95206CF3"
105
+ }
106
+ ]
107
+ },
108
+ "Metadata": {
109
+ "cfn_nag": {
110
+ "rules_to_suppress": [
111
+ {
112
+ "id": "W12",
113
+ "reason": "Lambda needs the following minimum required permissions to send trace data to X-Ray and access ENIs in a VPC."
114
+ }
115
+ ]
116
+ }
117
+ }
118
+ },
119
+ "testlambdakinesisstreamsLambdaFunction4348B6E4": {
120
+ "Type": "AWS::Lambda::Function",
121
+ "Properties": {
122
+ "Code": {
123
+ "S3Bucket": {
124
+ "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
125
+ },
126
+ "S3Key": "c7dc0cc1b24bda1d2a5345f61897eee32184906649fdb1de93853c512e129dbf.zip"
127
+ },
128
+ "Role": {
129
+ "Fn::GetAtt": [
130
+ "testlambdakinesisstreamsLambdaFunctionServiceRole95206CF3",
131
+ "Arn"
132
+ ]
133
+ },
134
+ "Environment": {
135
+ "Variables": {
136
+ "KINESIS_DATASTREAM_NAME": {
137
+ "Ref": "teststream04374A09"
138
+ }
139
+ }
140
+ },
141
+ "Handler": "index.handler",
142
+ "Runtime": "nodejs18.x",
143
+ "TracingConfig": {
144
+ "Mode": "Active"
145
+ }
146
+ },
147
+ "DependsOn": [
148
+ "testlambdakinesisstreamsLambdaFunctionServiceRoleDefaultPolicyED972043",
149
+ "testlambdakinesisstreamsLambdaFunctionServiceRole95206CF3"
150
+ ],
151
+ "Metadata": {
152
+ "cfn_nag": {
153
+ "rules_to_suppress": [
154
+ {
155
+ "id": "W58",
156
+ "reason": "Lambda functions has the required permission to write CloudWatch Logs. It uses custom policy instead of arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole with tighter permissions."
157
+ },
158
+ {
159
+ "id": "W89",
160
+ "reason": "This is not a rule for the general case, just for specific use cases/industries"
161
+ },
162
+ {
163
+ "id": "W92",
164
+ "reason": "Impossible for us to define the correct concurrency for clients"
165
+ }
166
+ ]
167
+ }
168
+ }
169
+ },
170
+ "testlambdakinesisstreamsKinesisStreamGetRecordsIteratorAgeAlarmC4A0FF00": {
171
+ "Type": "AWS::CloudWatch::Alarm",
172
+ "Properties": {
173
+ "ComparisonOperator": "GreaterThanOrEqualToThreshold",
174
+ "EvaluationPeriods": 1,
175
+ "AlarmDescription": "Consumer Record Processing Falling Behind, there is risk for data loss due to record expiration.",
176
+ "MetricName": "GetRecords.IteratorAgeMilliseconds",
177
+ "Namespace": "AWS/Kinesis",
178
+ "Period": 300,
179
+ "Statistic": "Maximum",
180
+ "Threshold": 43200000
181
+ }
182
+ },
183
+ "testlambdakinesisstreamsKinesisStreamReadProvisionedThroughputExceededAlarm9732E188": {
184
+ "Type": "AWS::CloudWatch::Alarm",
185
+ "Properties": {
186
+ "ComparisonOperator": "GreaterThanThreshold",
187
+ "EvaluationPeriods": 1,
188
+ "AlarmDescription": "Consumer Application is Reading at a Slower Rate Than Expected.",
189
+ "MetricName": "ReadProvisionedThroughputExceeded",
190
+ "Namespace": "AWS/Kinesis",
191
+ "Period": 300,
192
+ "Statistic": "Average",
193
+ "Threshold": 0
194
+ }
195
+ }
196
+ },
197
+ "Parameters": {
198
+ "BootstrapVersion": {
199
+ "Type": "AWS::SSM::Parameter::Value<String>",
200
+ "Default": "/cdk-bootstrap/hnb659fds/version",
201
+ "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
202
+ }
203
+ },
204
+ "Rules": {
205
+ "CheckBootstrapVersion": {
206
+ "Assertions": [
207
+ {
208
+ "Assert": {
209
+ "Fn::Not": [
210
+ {
211
+ "Fn::Contains": [
212
+ [
213
+ "1",
214
+ "2",
215
+ "3",
216
+ "4",
217
+ "5"
218
+ ],
219
+ {
220
+ "Ref": "BootstrapVersion"
221
+ }
222
+ ]
223
+ }
224
+ ]
225
+ },
226
+ "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
227
+ }
228
+ ]
229
+ }
230
+ }
231
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
6
+ * with the License. A copy of the License is located at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
11
+ * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
12
+ * and limitations under the License.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ /// !cdk-integ *
16
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
17
+ const lib_1 = require("../lib");
18
+ const core_1 = require("@aws-solutions-constructs/core");
19
+ const kinesis = require("aws-cdk-lib/aws-kinesis");
20
+ const lambda = require("aws-cdk-lib/aws-lambda");
21
+ const aws_kinesis_1 = require("aws-cdk-lib/aws-kinesis");
22
+ const app = new aws_cdk_lib_1.App();
23
+ const stack = new aws_cdk_lib_1.Stack(app, core_1.generateIntegStackName(__filename));
24
+ const existingStreamObj = new kinesis.Stream(stack, 'test-stream', {
25
+ streamMode: aws_kinesis_1.StreamMode.ON_DEMAND,
26
+ encryption: aws_kinesis_1.StreamEncryption.MANAGED
27
+ });
28
+ new lib_1.LambdaToKinesisStreams(stack, 'test-lambda-kinesisstreams', {
29
+ lambdaFunctionProps: {
30
+ code: lambda.Code.fromAsset(`${__dirname}/lambda`),
31
+ runtime: lambda.Runtime.NODEJS_18_X,
32
+ handler: 'index.handler'
33
+ },
34
+ existingStreamObj
35
+ });
36
+ app.synth();
37
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXhpc3RpbmdTdHJlYW0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5leGlzdGluZ1N0cmVhbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7O0dBV0c7O0FBRUgsZ0JBQWdCO0FBQ2hCLDZDQUF5QztBQUN6QyxnQ0FBZ0Q7QUFDaEQseURBQXdFO0FBQ3hFLG1EQUFtRDtBQUNuRCxpREFBaUQ7QUFDakQseURBQXVFO0FBRXZFLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsNkJBQXNCLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQztBQUVqRSxNQUFNLGlCQUFpQixHQUFHLElBQUksT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsYUFBYSxFQUFFO0lBQ2pFLFVBQVUsRUFBRSx3QkFBVSxDQUFDLFNBQVM7SUFDaEMsVUFBVSxFQUFFLDhCQUFnQixDQUFDLE9BQU87Q0FDckMsQ0FBQ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BsYW1iZGEuQ29kZS5mcm9tQXNzZXQoYCR7X19kaXJuYW1lfS9sYW1iZGFgKSxcbiAgICBydW50aW1lOiBsYW1iZGEuUnVudGltZS5OT0RFSlNfMThfWCxcbiAgICBoYW5kbGVyOiAnaW5kZXguaGFuZGxlcidcbiAgfSxcbiAgZXhpc3RpbmdTdHJlYW1PYmpcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ==
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
5
+ * with the License. A copy of the License is located at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
10
+ * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
13
+ export {};
@@ -0,0 +1,300 @@
1
+ {
2
+ "Resources": {
3
+ "testkey784D0285": {
4
+ "Type": "AWS::KMS::Key",
5
+ "Properties": {
6
+ "KeyPolicy": {
7
+ "Statement": [
8
+ {
9
+ "Action": "kms:*",
10
+ "Effect": "Allow",
11
+ "Principal": {
12
+ "AWS": {
13
+ "Fn::Join": [
14
+ "",
15
+ [
16
+ "arn:",
17
+ {
18
+ "Ref": "AWS::Partition"
19
+ },
20
+ ":iam::",
21
+ {
22
+ "Ref": "AWS::AccountId"
23
+ },
24
+ ":root"
25
+ ]
26
+ ]
27
+ }
28
+ },
29
+ "Resource": "*"
30
+ }
31
+ ],
32
+ "Version": "2012-10-17"
33
+ },
34
+ "EnableKeyRotation": true
35
+ },
36
+ "UpdateReplacePolicy": "Retain",
37
+ "DeletionPolicy": "Retain"
38
+ },
39
+ "teststream04374A09": {
40
+ "Type": "AWS::Kinesis::Stream",
41
+ "Properties": {
42
+ "RetentionPeriodHours": 24,
43
+ "ShardCount": 1,
44
+ "StreamEncryption": {
45
+ "EncryptionType": "KMS",
46
+ "KeyId": {
47
+ "Fn::GetAtt": [
48
+ "testkey784D0285",
49
+ "Arn"
50
+ ]
51
+ }
52
+ },
53
+ "StreamModeDetails": {
54
+ "StreamMode": "PROVISIONED"
55
+ }
56
+ }
57
+ },
58
+ "testlambdakinesisstreamsLambdaFunctionServiceRole95206CF3": {
59
+ "Type": "AWS::IAM::Role",
60
+ "Properties": {
61
+ "AssumeRolePolicyDocument": {
62
+ "Statement": [
63
+ {
64
+ "Action": "sts:AssumeRole",
65
+ "Effect": "Allow",
66
+ "Principal": {
67
+ "Service": "lambda.amazonaws.com"
68
+ }
69
+ }
70
+ ],
71
+ "Version": "2012-10-17"
72
+ },
73
+ "Policies": [
74
+ {
75
+ "PolicyDocument": {
76
+ "Statement": [
77
+ {
78
+ "Action": [
79
+ "logs:CreateLogGroup",
80
+ "logs:CreateLogStream",
81
+ "logs:PutLogEvents"
82
+ ],
83
+ "Effect": "Allow",
84
+ "Resource": {
85
+ "Fn::Join": [
86
+ "",
87
+ [
88
+ "arn:",
89
+ {
90
+ "Ref": "AWS::Partition"
91
+ },
92
+ ":logs:",
93
+ {
94
+ "Ref": "AWS::Region"
95
+ },
96
+ ":",
97
+ {
98
+ "Ref": "AWS::AccountId"
99
+ },
100
+ ":log-group:/aws/lambda/*"
101
+ ]
102
+ ]
103
+ }
104
+ }
105
+ ],
106
+ "Version": "2012-10-17"
107
+ },
108
+ "PolicyName": "LambdaFunctionServiceRolePolicy"
109
+ }
110
+ ]
111
+ }
112
+ },
113
+ "testlambdakinesisstreamsLambdaFunctionServiceRoleDefaultPolicyED972043": {
114
+ "Type": "AWS::IAM::Policy",
115
+ "Properties": {
116
+ "PolicyDocument": {
117
+ "Statement": [
118
+ {
119
+ "Action": [
120
+ "xray:PutTraceSegments",
121
+ "xray:PutTelemetryRecords"
122
+ ],
123
+ "Effect": "Allow",
124
+ "Resource": "*"
125
+ },
126
+ {
127
+ "Action": [
128
+ "kinesis:ListShards",
129
+ "kinesis:PutRecord",
130
+ "kinesis:PutRecords"
131
+ ],
132
+ "Effect": "Allow",
133
+ "Resource": {
134
+ "Fn::GetAtt": [
135
+ "teststream04374A09",
136
+ "Arn"
137
+ ]
138
+ }
139
+ },
140
+ {
141
+ "Action": [
142
+ "kms:Encrypt",
143
+ "kms:ReEncrypt*",
144
+ "kms:GenerateDataKey*"
145
+ ],
146
+ "Effect": "Allow",
147
+ "Resource": {
148
+ "Fn::GetAtt": [
149
+ "testkey784D0285",
150
+ "Arn"
151
+ ]
152
+ }
153
+ },
154
+ {
155
+ "Action": [
156
+ "kms:Decrypt",
157
+ "kms:GenerateDataKey*"
158
+ ],
159
+ "Effect": "Allow",
160
+ "Resource": {
161
+ "Fn::GetAtt": [
162
+ "testkey784D0285",
163
+ "Arn"
164
+ ]
165
+ }
166
+ }
167
+ ],
168
+ "Version": "2012-10-17"
169
+ },
170
+ "PolicyName": "testlambdakinesisstreamsLambdaFunctionServiceRoleDefaultPolicyED972043",
171
+ "Roles": [
172
+ {
173
+ "Ref": "testlambdakinesisstreamsLambdaFunctionServiceRole95206CF3"
174
+ }
175
+ ]
176
+ },
177
+ "Metadata": {
178
+ "cfn_nag": {
179
+ "rules_to_suppress": [
180
+ {
181
+ "id": "W12",
182
+ "reason": "Lambda needs the following minimum required permissions to send trace data to X-Ray and access ENIs in a VPC."
183
+ }
184
+ ]
185
+ }
186
+ }
187
+ },
188
+ "testlambdakinesisstreamsLambdaFunction4348B6E4": {
189
+ "Type": "AWS::Lambda::Function",
190
+ "Properties": {
191
+ "Code": {
192
+ "S3Bucket": {
193
+ "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
194
+ },
195
+ "S3Key": "c7dc0cc1b24bda1d2a5345f61897eee32184906649fdb1de93853c512e129dbf.zip"
196
+ },
197
+ "Role": {
198
+ "Fn::GetAtt": [
199
+ "testlambdakinesisstreamsLambdaFunctionServiceRole95206CF3",
200
+ "Arn"
201
+ ]
202
+ },
203
+ "Environment": {
204
+ "Variables": {
205
+ "KINESIS_DATASTREAM_NAME": {
206
+ "Ref": "teststream04374A09"
207
+ }
208
+ }
209
+ },
210
+ "Handler": "index.handler",
211
+ "Runtime": "nodejs18.x",
212
+ "TracingConfig": {
213
+ "Mode": "Active"
214
+ }
215
+ },
216
+ "DependsOn": [
217
+ "testlambdakinesisstreamsLambdaFunctionServiceRoleDefaultPolicyED972043",
218
+ "testlambdakinesisstreamsLambdaFunctionServiceRole95206CF3"
219
+ ],
220
+ "Metadata": {
221
+ "cfn_nag": {
222
+ "rules_to_suppress": [
223
+ {
224
+ "id": "W58",
225
+ "reason": "Lambda functions has the required permission to write CloudWatch Logs. It uses custom policy instead of arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole with tighter permissions."
226
+ },
227
+ {
228
+ "id": "W89",
229
+ "reason": "This is not a rule for the general case, just for specific use cases/industries"
230
+ },
231
+ {
232
+ "id": "W92",
233
+ "reason": "Impossible for us to define the correct concurrency for clients"
234
+ }
235
+ ]
236
+ }
237
+ }
238
+ },
239
+ "testlambdakinesisstreamsKinesisStreamGetRecordsIteratorAgeAlarmC4A0FF00": {
240
+ "Type": "AWS::CloudWatch::Alarm",
241
+ "Properties": {
242
+ "ComparisonOperator": "GreaterThanOrEqualToThreshold",
243
+ "EvaluationPeriods": 1,
244
+ "AlarmDescription": "Consumer Record Processing Falling Behind, there is risk for data loss due to record expiration.",
245
+ "MetricName": "GetRecords.IteratorAgeMilliseconds",
246
+ "Namespace": "AWS/Kinesis",
247
+ "Period": 300,
248
+ "Statistic": "Maximum",
249
+ "Threshold": 43200000
250
+ }
251
+ },
252
+ "testlambdakinesisstreamsKinesisStreamReadProvisionedThroughputExceededAlarm9732E188": {
253
+ "Type": "AWS::CloudWatch::Alarm",
254
+ "Properties": {
255
+ "ComparisonOperator": "GreaterThanThreshold",
256
+ "EvaluationPeriods": 1,
257
+ "AlarmDescription": "Consumer Application is Reading at a Slower Rate Than Expected.",
258
+ "MetricName": "ReadProvisionedThroughputExceeded",
259
+ "Namespace": "AWS/Kinesis",
260
+ "Period": 300,
261
+ "Statistic": "Average",
262
+ "Threshold": 0
263
+ }
264
+ }
265
+ },
266
+ "Parameters": {
267
+ "BootstrapVersion": {
268
+ "Type": "AWS::SSM::Parameter::Value<String>",
269
+ "Default": "/cdk-bootstrap/hnb659fds/version",
270
+ "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
271
+ }
272
+ },
273
+ "Rules": {
274
+ "CheckBootstrapVersion": {
275
+ "Assertions": [
276
+ {
277
+ "Assert": {
278
+ "Fn::Not": [
279
+ {
280
+ "Fn::Contains": [
281
+ [
282
+ "1",
283
+ "2",
284
+ "3",
285
+ "4",
286
+ "5"
287
+ ],
288
+ {
289
+ "Ref": "BootstrapVersion"
290
+ }
291
+ ]
292
+ }
293
+ ]
294
+ },
295
+ "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
296
+ }
297
+ ]
298
+ }
299
+ }
300
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
6
+ * with the License. A copy of the License is located at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
11
+ * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
12
+ * and limitations under the License.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ /// !cdk-integ *
16
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
17
+ const lib_1 = require("../lib");
18
+ const core_1 = require("@aws-solutions-constructs/core");
19
+ const kinesis = require("aws-cdk-lib/aws-kinesis");
20
+ const kms = require("aws-cdk-lib/aws-kms");
21
+ const lambda = require("aws-cdk-lib/aws-lambda");
22
+ const app = new aws_cdk_lib_1.App();
23
+ const stack = new aws_cdk_lib_1.Stack(app, core_1.generateIntegStackName(__filename));
24
+ const encryptionKey = new kms.Key(stack, 'test-key', {
25
+ enableKeyRotation: true
26
+ });
27
+ const existingStreamObj = new kinesis.Stream(stack, 'test-stream', {
28
+ encryptionKey
29
+ });
30
+ new lib_1.LambdaToKinesisStreams(stack, 'test-lambda-kinesisstreams', {
31
+ lambdaFunctionProps: {
32
+ code: lambda.Code.fromAsset(`${__dirname}/lambda`),
33
+ runtime: lambda.Runtime.NODEJS_18_X,
34
+ handler: 'index.handler'
35
+ },
36
+ existingStreamObj
37
+ });
38
+ app.synth();
39
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXhpc3RpbmdTdHJlYW1XaXRoQ21rLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZXhpc3RpbmdTdHJlYW1XaXRoQ21rLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7R0FXRzs7QUFFSCxnQkFBZ0I7QUFDaEIsNkNBQXlDO0FBQ3pDLGdDQUFnRDtBQUNoRCx5REFBd0U7QUFDeEUsbURBQW1EO0FBQ25ELDJDQUEyQztBQUMzQyxpREFBaUQ7QUFFakQsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSw2QkFBc0IsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDO0FBRWpFLE1BQU0sYUFBYSxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsVUFBVSxFQUFFO0lBQ25ELGlCQUFpQixFQUFFLElBQUk7Q0FDeEIsQ0FB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Ub0tpbmVzaXNTdHJlYW1zKHN0YWNrLCAndGVzdC1sYW1iZGEta2luZXNpc3N0cmVhbXMnLCB7XG4gIGxhbWJkYUZ1bmN0aW9uUHJvcHM6IHtcbiAgICBjb2RlOiBsYW1iZGEuQ29kZS5mcm9tQXNzZXQoYCR7X19kaXJuYW1lfS9sYW1iZGFgKSxcbiAgICBydW50aW1lOiBsYW1iZGEuUnVudGltZS5OT0RFSlNfMThfWCxcbiAgICBoYW5kbGVyOiAnaW5kZXguaGFuZGxlcidcbiAgfSxcbiAgZXhpc3RpbmdTdHJlYW1PYmpcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ==
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
5
+ * with the License. A copy of the License is located at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
10
+ * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
13
+ export {};