@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.
- package/.eslintignore +5 -0
- package/.jsii +3655 -0
- package/README.md +121 -0
- package/architecture.png +0 -0
- package/lib/index.d.ts +90 -0
- package/lib/index.js +64 -0
- package/package.json +92 -0
- package/test/integ.existingLambda.d.ts +13 -0
- package/test/integ.existingLambda.expected.json +232 -0
- package/test/integ.existingLambda.js +31 -0
- package/test/integ.existingStream.d.ts +13 -0
- package/test/integ.existingStream.expected.json +231 -0
- package/test/integ.existingStream.js +37 -0
- package/test/integ.existingStreamWithCmk.d.ts +13 -0
- package/test/integ.existingStreamWithCmk.expected.json +300 -0
- package/test/integ.existingStreamWithCmk.js +39 -0
- package/test/integ.existingVpc.d.ts +13 -0
- package/test/integ.existingVpc.expected.json +1068 -0
- package/test/integ.existingVpc.js +34 -0
- package/test/integ.newStreamFromProps.d.ts +13 -0
- package/test/integ.newStreamFromProps.expected.json +231 -0
- package/test/integ.newStreamFromProps.js +34 -0
- package/test/integ.newVpc.d.ts +13 -0
- package/test/integ.newVpc.expected.json +674 -0
- package/test/integ.newVpc.js +31 -0
- package/test/integ.newVpcFromProps.d.ts +13 -0
- package/test/integ.newVpcFromProps.expected.json +560 -0
- package/test/integ.newVpcFromProps.js +34 -0
- package/test/integ.noArguments.d.ts +13 -0
- package/test/integ.noArguments.expected.json +232 -0
- package/test/integ.noArguments.js +30 -0
- package/test/lambda/index.mjs +15 -0
- package/test/lambda-kinesisstream.test.d.ts +13 -0
- package/test/lambda-kinesisstream.test.js +472 -0
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# aws-lambda-kinesisstreams module
|
|
2
|
+
<!--BEGIN STABILITY BANNER-->
|
|
3
|
+
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
<!--END STABILITY BANNER-->
|
|
10
|
+
|
|
11
|
+
| **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
|
|
12
|
+
|:-------------|:-------------|
|
|
13
|
+
<div style="height:8px"></div>
|
|
14
|
+
|
|
15
|
+
| **Language** | **Package** |
|
|
16
|
+
|:-------------|-----------------|
|
|
17
|
+
| Python|`aws_solutions_constructs.aws_lambda_kinesis_stream`|
|
|
18
|
+
| Typescript|`@aws-solutions-constructs/aws-lambda-kinesisstreams`|
|
|
19
|
+
| Java|`software.amazon.awsconstructs.services.lambdakinesisstreams`|
|
|
20
|
+
|
|
21
|
+
## Overview
|
|
22
|
+
This AWS Solutions Construct deploys an AWS Lambda Function that can put records on an Amazon Kinesis Data Stream.
|
|
23
|
+
|
|
24
|
+
Here is a minimal deployable pattern definition:
|
|
25
|
+
|
|
26
|
+
Typescript
|
|
27
|
+
``` typescript
|
|
28
|
+
import { Construct } from 'constructs';
|
|
29
|
+
import { Stack, StackProps } from 'aws-cdk-lib';
|
|
30
|
+
import { LambdaToKinesisStreamsProps } from '@aws-solutions-constructs/aws-lambda-kinesisstreams';
|
|
31
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
32
|
+
|
|
33
|
+
new LambdaToKinesisStreams(this, 'LambdaToKinesisStreams', {
|
|
34
|
+
lambdaFunctionProps: {
|
|
35
|
+
runtime: lambda.Runtime.NODEJS_18_X,
|
|
36
|
+
handler: 'index.handler',
|
|
37
|
+
code: lambda.Code.fromAsset(`lambda`)
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Python
|
|
43
|
+
``` python
|
|
44
|
+
from aws_solutions_constructs.aws_lambda_kinesis_stream import LambdaToKinesisStreams
|
|
45
|
+
from aws_cdk import (
|
|
46
|
+
aws_lambda as _lambda,
|
|
47
|
+
aws_kinesis as kinesis,
|
|
48
|
+
Stack
|
|
49
|
+
)
|
|
50
|
+
from constructs import Construct
|
|
51
|
+
|
|
52
|
+
LambdaToKinesisStreams(self, 'LambdaToKinesisStreams',
|
|
53
|
+
lambda_function_props=_lambda.FunctionProps(
|
|
54
|
+
runtime=_lambda.Runtime.PYTHON_3_9,
|
|
55
|
+
handler='index.handler',
|
|
56
|
+
code=_lambda.Code.from_asset('lambda')
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Java
|
|
62
|
+
``` java
|
|
63
|
+
import software.constructs.Construct;
|
|
64
|
+
|
|
65
|
+
import software.amazon.awscdk.Stack;
|
|
66
|
+
import software.amazon.awscdk.StackProps;
|
|
67
|
+
import software.amazon.awscdk.services.lambda.*;
|
|
68
|
+
import software.amazon.awscdk.services.lambda.eventsources.*;
|
|
69
|
+
import software.amazon.awscdk.services.lambda.Runtime;
|
|
70
|
+
import software.amazon.awsconstructs.services.lambdakinesisstreams.*;
|
|
71
|
+
|
|
72
|
+
new LambdaToKinesisStreams(this, "LambdaToKinesisStreams", new LambdaToKinesisStreamsProps.Builder()
|
|
73
|
+
.lambdaFunctionProps(new FunctionProps.Builder()
|
|
74
|
+
.runtime(Runtime.NODEJS_18_X)
|
|
75
|
+
.code(Code.fromAsset("lambda"))
|
|
76
|
+
.handler("index.handler")
|
|
77
|
+
.build())
|
|
78
|
+
.build());
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Pattern Construct Props
|
|
82
|
+
|
|
83
|
+
| **Name** | **Type** | **Description** |
|
|
84
|
+
|:-------------|:----------------|-----------------|
|
|
85
|
+
|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Existing instance of a Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.|
|
|
86
|
+
|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html)|User provided props to override the default props for the Lambda Function.|
|
|
87
|
+
|existingStreamObj?|[`kinesis.Stream`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kinesis.Stream.html)|Existing instance of a Kinesis Data Stream, providing both this and `kinesisStreamProps` will cause an error.|
|
|
88
|
+
|kinesisStreamProps?|[`kinesis.StreamProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kinesis.StreamProps.html)|Optional user-provided props to override the default props for the Kinesis Data Stream.|
|
|
89
|
+
|createCloudWatchAlarms|`boolean`|Whether to create recommended CloudWatch Alarms (defaults to true).|
|
|
90
|
+
|existingVpc?|[`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html)|An optional, existing VPC into which this pattern should be deployed. When deployed in a VPC, the Lambda function will use ENIs in the VPC to access network resources and an Interface Endpoint will be created in the VPC for Amazon Kinesis Streams. If an existing VPC is provided, the `deployVpc` property cannot be `true`. This uses `ec2.IVpc` to allow clients to supply VPCs that exist outside the stack using the [`ec2.Vpc.fromLookup()`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html#static-fromwbrlookupscope-id-options) method.|
|
|
91
|
+
|vpcProps?|[`ec2.VpcProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcProps.html)|Optional user-provided properties to override the default properties for the new VPC. `enableDnsHostnames`, `enableDnsSupport`, `natGateways` and `subnetConfiguration` are set by the pattern, so any values for those properties supplied here will be overrriden. If `deployVpc` is not `true` then this property will be ignored.|
|
|
92
|
+
|deployVpc?|`boolean`|Whether to create a new VPC based on `vpcProps` into which to deploy this pattern. Setting this to true will deploy the minimal, most private VPC to run the pattern:<ul><li> One isolated subnet in each Availability Zone used by the CDK program</li><li>`enableDnsHostnames` and `enableDnsSupport` will both be set to true</li></ul>If this property is `true` then `existingVpc` cannot be specified. Defaults to `false`.|
|
|
93
|
+
|streamEnvironmentVariableName?|`string`|Optional Name to override the Lambda Function default environment variable name that holds the Kinesis Data Stream name value. Default: KINESIS_DATASTREAM_NAME |
|
|
94
|
+
|
|
95
|
+
## Pattern Properties
|
|
96
|
+
|
|
97
|
+
| **Name** | **Type** | **Description** |
|
|
98
|
+
|:-------------|:----------------|-----------------|
|
|
99
|
+
|lambdaFunction|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Returns an instance of the Lambda Function.|
|
|
100
|
+
|kinesisStream|[`kinesis.Stream`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kinesis.Stream.html)|Returns an instance of the Kinesis Data Stream.|
|
|
101
|
+
|cloudwatchAlarms?|[`cloudwatch.Alarm[]`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.Alarm.html)|Returns the CloudWatch Alarms created to monitor the Kinesis Data Stream.|
|
|
102
|
+
|vpc?|[`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html)|Returns an interface to the VPC used by the pattern (if any). This may be a VPC created by the pattern or the VPC supplied to the pattern constructor.|
|
|
103
|
+
|
|
104
|
+
## Default settings
|
|
105
|
+
|
|
106
|
+
Out of the box implementation of the Construct without any overrides will set the following defaults:
|
|
107
|
+
|
|
108
|
+
### AWS Lambda Function
|
|
109
|
+
* Minimally-permissive IAM role for the Lambda Function to put records on the Kinesis Data Stream
|
|
110
|
+
* Enable X-Ray Tracing
|
|
111
|
+
* Sets an Environment Variable named KINESIS_DATASTREAM_NAME that holds the Kinesis Data Stream Name, which is a required property Kinesis Data Streams SDK when making calls to it
|
|
112
|
+
|
|
113
|
+
### Amazon Kinesis Stream
|
|
114
|
+
* Enable server-side encryption for the Kinesis Data Stream using AWS Managed CMK
|
|
115
|
+
* Deploy best practices CloudWatch Alarms for the Kinesis Data Stream
|
|
116
|
+
|
|
117
|
+
## Architecture
|
|
118
|
+

|
|
119
|
+
|
|
120
|
+
***
|
|
121
|
+
© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
package/architecture.png
ADDED
|
Binary file
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
14
|
+
import * as kinesis from 'aws-cdk-lib/aws-kinesis';
|
|
15
|
+
import { Construct } from 'constructs';
|
|
16
|
+
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
|
|
17
|
+
import * as ec2 from "aws-cdk-lib/aws-ec2";
|
|
18
|
+
/**
|
|
19
|
+
* The properties for the LambdaToKinesisStreams class.
|
|
20
|
+
*/
|
|
21
|
+
export interface LambdaToKinesisStreamsProps {
|
|
22
|
+
/**
|
|
23
|
+
* Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.
|
|
24
|
+
*
|
|
25
|
+
* @default - None
|
|
26
|
+
*/
|
|
27
|
+
readonly existingLambdaObj?: lambda.Function;
|
|
28
|
+
/**
|
|
29
|
+
* User provided props to override the default props for the Lambda function.
|
|
30
|
+
*
|
|
31
|
+
* @default - Default props are used.
|
|
32
|
+
*/
|
|
33
|
+
readonly lambdaFunctionProps?: lambda.FunctionProps;
|
|
34
|
+
/**
|
|
35
|
+
* Existing instance of Kinesis Stream, providing both this and `kinesisStreamProps` will cause an error.
|
|
36
|
+
*
|
|
37
|
+
* @default - None
|
|
38
|
+
*/
|
|
39
|
+
readonly existingStreamObj?: kinesis.Stream;
|
|
40
|
+
/**
|
|
41
|
+
* Optional user-provided props to override the default props for the Kinesis stream.
|
|
42
|
+
*
|
|
43
|
+
* @default - Default props are used.
|
|
44
|
+
*/
|
|
45
|
+
readonly kinesisStreamProps?: kinesis.StreamProps;
|
|
46
|
+
/**
|
|
47
|
+
* Whether to create recommended CloudWatch alarms for the Kinesis Stream
|
|
48
|
+
*
|
|
49
|
+
* @default - Alarms are created
|
|
50
|
+
*/
|
|
51
|
+
readonly createCloudWatchAlarms?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* An existing VPC for the construct to use (construct will NOT create a new VPC in this case)
|
|
54
|
+
*/
|
|
55
|
+
readonly existingVpc?: ec2.IVpc;
|
|
56
|
+
/**
|
|
57
|
+
* Properties to override default properties if deployVpc is true
|
|
58
|
+
*/
|
|
59
|
+
readonly vpcProps?: ec2.VpcProps;
|
|
60
|
+
/**
|
|
61
|
+
* Whether to deploy a new VPC
|
|
62
|
+
*
|
|
63
|
+
* @default - false
|
|
64
|
+
*/
|
|
65
|
+
readonly deployVpc?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Optional Name to override the Lambda Function default environment variable name that holds the Kinesis Data Stream name value
|
|
68
|
+
*
|
|
69
|
+
* @default - KINESIS_DATASTREAM_NAME
|
|
70
|
+
*/
|
|
71
|
+
readonly streamEnvironmentVariableName?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @summary The LambdaToKinesisStream class.
|
|
75
|
+
*/
|
|
76
|
+
export declare class LambdaToKinesisStreams extends Construct {
|
|
77
|
+
readonly vpc?: ec2.IVpc;
|
|
78
|
+
readonly kinesisStream: kinesis.Stream;
|
|
79
|
+
readonly lambdaFunction: lambda.Function;
|
|
80
|
+
readonly cloudwatchAlarms?: cloudwatch.Alarm[];
|
|
81
|
+
/**
|
|
82
|
+
* @summary Constructs a new instance of the KinesisStreamsToLambda class.
|
|
83
|
+
* @param {cdk.App} scope - represents the scope for all the resources.
|
|
84
|
+
* @param {string} id - this is a a scope-unique id.
|
|
85
|
+
* @param {LambdaToKinesisStreamsProps} props - user provided props for the construct
|
|
86
|
+
* @since 0.8.0
|
|
87
|
+
* @access public
|
|
88
|
+
*/
|
|
89
|
+
constructor(scope: Construct, id: string, props: LambdaToKinesisStreamsProps);
|
|
90
|
+
}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.LambdaToKinesisStreams = void 0;
|
|
5
|
+
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
6
|
+
const defaults = require("@aws-solutions-constructs/core");
|
|
7
|
+
// Note: To ensure CDKv2 compatibility, keep the import statement for Construct separate
|
|
8
|
+
const constructs_1 = require("constructs");
|
|
9
|
+
/**
|
|
10
|
+
* @summary The LambdaToKinesisStream class.
|
|
11
|
+
*/
|
|
12
|
+
class LambdaToKinesisStreams extends constructs_1.Construct {
|
|
13
|
+
/**
|
|
14
|
+
* @summary Constructs a new instance of the KinesisStreamsToLambda class.
|
|
15
|
+
* @param {cdk.App} scope - represents the scope for all the resources.
|
|
16
|
+
* @param {string} id - this is a a scope-unique id.
|
|
17
|
+
* @param {LambdaToKinesisStreamsProps} props - user provided props for the construct
|
|
18
|
+
* @since 0.8.0
|
|
19
|
+
* @access public
|
|
20
|
+
*/
|
|
21
|
+
constructor(scope, id, props) {
|
|
22
|
+
super(scope, id);
|
|
23
|
+
defaults.CheckProps(props);
|
|
24
|
+
// Setup the VPC
|
|
25
|
+
if (props.deployVpc || props.existingVpc) {
|
|
26
|
+
this.vpc = defaults.buildVpc(scope, {
|
|
27
|
+
defaultVpcProps: defaults.DefaultIsolatedVpcProps(),
|
|
28
|
+
existingVpc: props.existingVpc,
|
|
29
|
+
userVpcProps: props.vpcProps,
|
|
30
|
+
constructVpcProps: {
|
|
31
|
+
enableDnsHostnames: true,
|
|
32
|
+
enableDnsSupport: true,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
defaults.AddAwsServiceEndpoint(scope, this.vpc, defaults.ServiceEndpointTypes.KINESIS_STREAMS);
|
|
36
|
+
}
|
|
37
|
+
// Setup the Lambda function
|
|
38
|
+
this.lambdaFunction = defaults.buildLambdaFunction(this, {
|
|
39
|
+
existingLambdaObj: props.existingLambdaObj,
|
|
40
|
+
lambdaFunctionProps: props.lambdaFunctionProps,
|
|
41
|
+
vpc: this.vpc
|
|
42
|
+
});
|
|
43
|
+
// Setup the Kinesis Stream
|
|
44
|
+
this.kinesisStream = defaults.buildKinesisStream(this, {
|
|
45
|
+
existingStreamObj: props.existingStreamObj,
|
|
46
|
+
kinesisStreamProps: props.kinesisStreamProps
|
|
47
|
+
});
|
|
48
|
+
// Configure Lambda Function environment variables
|
|
49
|
+
const streamNameEnvironmentVariableName = props.streamEnvironmentVariableName || 'KINESIS_DATASTREAM_NAME';
|
|
50
|
+
this.lambdaFunction.addEnvironment(streamNameEnvironmentVariableName, this.kinesisStream.streamName);
|
|
51
|
+
// Grant the Lambda Function permission to write to the Kinesis Stream
|
|
52
|
+
this.kinesisStream.grantWrite(this.lambdaFunction.grantPrincipal);
|
|
53
|
+
// Grant the Lambda Function permission to use the stream's encryption key so it can publish messages to it
|
|
54
|
+
this.kinesisStream.encryptionKey?.grant(this.lambdaFunction.grantPrincipal, 'kms:Decrypt', 'kms:GenerateDataKey*');
|
|
55
|
+
if (props.createCloudWatchAlarms === undefined || props.createCloudWatchAlarms) {
|
|
56
|
+
// Deploy best practices CW Alarms for Kinesis Stream
|
|
57
|
+
this.cloudwatchAlarms = defaults.buildKinesisStreamCWAlarms(this);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.LambdaToKinesisStreams = LambdaToKinesisStreams;
|
|
62
|
+
_a = JSII_RTTI_SYMBOL_1;
|
|
63
|
+
LambdaToKinesisStreams[_a] = { fqn: "@aws-solutions-constructs/aws-lambda-kinesisstreams.LambdaToKinesisStreams", version: "2.30.0" };
|
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQWdCQSwyREFBMkQ7QUFDM0Qsd0ZBQXdGO0FBQ3hGLDJDQUF1QztBQTREdkM7O0dBRUc7QUFDSCxNQUFhLHNCQUF1QixTQUFRLHNCQUFTO0lBTWpEOzs7Ozs7O09BT0c7SUFDSCxZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQWtDO1FBQzFFLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFDakIsUUFBUSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUUzQixnQkFBZ0I7UUFDaEIsSUFBSSxLQUFLLENBQUMsU0FBUyxJQUFJLEtBQUssQ0FBQyxXQUFXLEVBQUU7WUFDeEMsSUFBSSxDQUFDLEdBQUcsR0FBRyxRQUFRLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRTtnQkFDbEMsZUFBZSxFQUFFLFFBQVEsQ0FBQyx1QkFBdUIsRUFBRTtnQkFDbkQsV0FBVyxFQUFFLEtBQUssQ0FBQyxXQUFXO2dCQUM5QixZQUFZLEVBQUUsS0FBSyxDQUFDLFFBQVE7Z0JBQzVCLGlCQUFpQixFQUFFO29CQUNqQixrQkFBa0IsRUFBRSxJQUFJO29CQUN4QixnQkFBZ0IsRUFBRSxJQUFJO2lCQUN2QjthQUNGLENBQUMsQ0FBQztZQUVILFFBQVEsQ0FBQyxxQkFBcUIsQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQU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gQ1cgQWxhcm1zIGZvciBLaW5lc2lzIFN0cmVhbVxuICAgICAgICB0aGlzLmNsb3Vkd2F0Y2hBbGFybXMgPSBkZWZhdWx0cy5idWlsZEtpbmVzaXNTdHJlYW1DV0FsYXJtcyh0aGlzKTtcbiAgICAgIH1cbiAgICB9XG59Il19
|
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aws-solutions-constructs/aws-lambda-kinesisstreams",
|
|
3
|
+
"version": "2.30.0",
|
|
4
|
+
"description": "CDK constructs for defining an interaction between an AWS Lambda Function and an Amazon Kinesis Data Stream.",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/awslabs/aws-solutions-constructs.git",
|
|
10
|
+
"directory": "source/patterns/@aws-solutions-constructs/aws-lambda-kinesisstreams"
|
|
11
|
+
},
|
|
12
|
+
"author": {
|
|
13
|
+
"name": "Amazon Web Services",
|
|
14
|
+
"url": "https://aws.amazon.com",
|
|
15
|
+
"organization": true
|
|
16
|
+
},
|
|
17
|
+
"license": "Apache-2.0",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -b .",
|
|
20
|
+
"lint": "eslint -c ../eslintrc.yml --ext=.js,.ts . && tslint --project .",
|
|
21
|
+
"lint-fix": "eslint -c ../eslintrc.yml --ext=.js,.ts --fix .",
|
|
22
|
+
"test": "jest --coverage",
|
|
23
|
+
"clean": "tsc -b --clean",
|
|
24
|
+
"watch": "tsc -b -w",
|
|
25
|
+
"integ": "cdk-integ",
|
|
26
|
+
"integ-no-clean": "cdk-integ --no-clean",
|
|
27
|
+
"integ-assert": "cdk-integ-assert-v2",
|
|
28
|
+
"jsii": "jsii",
|
|
29
|
+
"jsii-pacmak": "jsii-pacmak",
|
|
30
|
+
"build+lint+test": "npm run jsii && npm run lint && npm test && npm run integ-assert",
|
|
31
|
+
"snapshot-update": "npm run jsii && npm test -- -u && npm run integ-assert"
|
|
32
|
+
},
|
|
33
|
+
"jsii": {
|
|
34
|
+
"outdir": "dist",
|
|
35
|
+
"targets": {
|
|
36
|
+
"java": {
|
|
37
|
+
"package": "software.amazon.awsconstructs.services.lambdakinesisstreams",
|
|
38
|
+
"maven": {
|
|
39
|
+
"groupId": "software.amazon.awsconstructs",
|
|
40
|
+
"artifactId": "lambdakinesisstreams"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"dotnet": {
|
|
44
|
+
"namespace": "Amazon.SolutionsConstructs.AWS.lambdakinesisstreams",
|
|
45
|
+
"packageId": "Amazon.SolutionsConstructs.AWS.LambdaKinesisStreams",
|
|
46
|
+
"signAssembly": true,
|
|
47
|
+
"iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/master/logo/default-256-dark.png"
|
|
48
|
+
},
|
|
49
|
+
"python": {
|
|
50
|
+
"distName": "aws-solutions-constructs.aws-lambda-kinesis-streams",
|
|
51
|
+
"module": "aws_solutions_constructs.aws_lambda_kinesis_streams"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@aws-solutions-constructs/core": "2.30.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@aws-cdk/assert": "2.57.0",
|
|
60
|
+
"@types/jest": "^27.4.0",
|
|
61
|
+
"@types/node": "^10.3.0",
|
|
62
|
+
"aws-cdk-lib": "2.57.0",
|
|
63
|
+
"constructs": "^10.0.0"
|
|
64
|
+
},
|
|
65
|
+
"jest": {
|
|
66
|
+
"moduleFileExtensions": [
|
|
67
|
+
"js"
|
|
68
|
+
],
|
|
69
|
+
"coverageReporters": [
|
|
70
|
+
"text",
|
|
71
|
+
[
|
|
72
|
+
"lcov",
|
|
73
|
+
{
|
|
74
|
+
"projectRoot": "../../../../"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"@aws-solutions-constructs/core": "2.30.0",
|
|
81
|
+
"aws-cdk-lib": "^2.57.0",
|
|
82
|
+
"constructs": "^10.0.0"
|
|
83
|
+
},
|
|
84
|
+
"keywords": [
|
|
85
|
+
"aws",
|
|
86
|
+
"cdk",
|
|
87
|
+
"awscdk",
|
|
88
|
+
"AWS Solutions Constructs",
|
|
89
|
+
"AWS Lambda",
|
|
90
|
+
"Amazon Kinesis Data Streams"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
@@ -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,232 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Resources": {
|
|
3
|
+
"LambdaFunctionServiceRole0C4CDE0B": {
|
|
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
|
+
"Policies": [
|
|
19
|
+
{
|
|
20
|
+
"PolicyDocument": {
|
|
21
|
+
"Statement": [
|
|
22
|
+
{
|
|
23
|
+
"Action": [
|
|
24
|
+
"logs:CreateLogGroup",
|
|
25
|
+
"logs:CreateLogStream",
|
|
26
|
+
"logs:PutLogEvents"
|
|
27
|
+
],
|
|
28
|
+
"Effect": "Allow",
|
|
29
|
+
"Resource": {
|
|
30
|
+
"Fn::Join": [
|
|
31
|
+
"",
|
|
32
|
+
[
|
|
33
|
+
"arn:",
|
|
34
|
+
{
|
|
35
|
+
"Ref": "AWS::Partition"
|
|
36
|
+
},
|
|
37
|
+
":logs:",
|
|
38
|
+
{
|
|
39
|
+
"Ref": "AWS::Region"
|
|
40
|
+
},
|
|
41
|
+
":",
|
|
42
|
+
{
|
|
43
|
+
"Ref": "AWS::AccountId"
|
|
44
|
+
},
|
|
45
|
+
":log-group:/aws/lambda/*"
|
|
46
|
+
]
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"Version": "2012-10-17"
|
|
52
|
+
},
|
|
53
|
+
"PolicyName": "LambdaFunctionServiceRolePolicy"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"LambdaFunctionServiceRoleDefaultPolicy126C8897": {
|
|
59
|
+
"Type": "AWS::IAM::Policy",
|
|
60
|
+
"Properties": {
|
|
61
|
+
"PolicyDocument": {
|
|
62
|
+
"Statement": [
|
|
63
|
+
{
|
|
64
|
+
"Action": [
|
|
65
|
+
"xray:PutTraceSegments",
|
|
66
|
+
"xray:PutTelemetryRecords"
|
|
67
|
+
],
|
|
68
|
+
"Effect": "Allow",
|
|
69
|
+
"Resource": "*"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"Action": [
|
|
73
|
+
"kinesis:ListShards",
|
|
74
|
+
"kinesis:PutRecord",
|
|
75
|
+
"kinesis:PutRecords"
|
|
76
|
+
],
|
|
77
|
+
"Effect": "Allow",
|
|
78
|
+
"Resource": {
|
|
79
|
+
"Fn::GetAtt": [
|
|
80
|
+
"testlambdakinesisstreamsKinesisStream11A82116",
|
|
81
|
+
"Arn"
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"Version": "2012-10-17"
|
|
87
|
+
},
|
|
88
|
+
"PolicyName": "LambdaFunctionServiceRoleDefaultPolicy126C8897",
|
|
89
|
+
"Roles": [
|
|
90
|
+
{
|
|
91
|
+
"Ref": "LambdaFunctionServiceRole0C4CDE0B"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"Metadata": {
|
|
96
|
+
"cfn_nag": {
|
|
97
|
+
"rules_to_suppress": [
|
|
98
|
+
{
|
|
99
|
+
"id": "W12",
|
|
100
|
+
"reason": "Lambda needs the following minimum required permissions to send trace data to X-Ray and access ENIs in a VPC."
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"LambdaFunctionBF21E41F": {
|
|
107
|
+
"Type": "AWS::Lambda::Function",
|
|
108
|
+
"Properties": {
|
|
109
|
+
"Code": {
|
|
110
|
+
"S3Bucket": {
|
|
111
|
+
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
|
|
112
|
+
},
|
|
113
|
+
"S3Key": "c7dc0cc1b24bda1d2a5345f61897eee32184906649fdb1de93853c512e129dbf.zip"
|
|
114
|
+
},
|
|
115
|
+
"Role": {
|
|
116
|
+
"Fn::GetAtt": [
|
|
117
|
+
"LambdaFunctionServiceRole0C4CDE0B",
|
|
118
|
+
"Arn"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"Environment": {
|
|
122
|
+
"Variables": {
|
|
123
|
+
"KINESIS_DATASTREAM_NAME": {
|
|
124
|
+
"Ref": "testlambdakinesisstreamsKinesisStream11A82116"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"Handler": "index.handler",
|
|
129
|
+
"Runtime": "nodejs18.x",
|
|
130
|
+
"TracingConfig": {
|
|
131
|
+
"Mode": "Active"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"DependsOn": [
|
|
135
|
+
"LambdaFunctionServiceRoleDefaultPolicy126C8897",
|
|
136
|
+
"LambdaFunctionServiceRole0C4CDE0B"
|
|
137
|
+
],
|
|
138
|
+
"Metadata": {
|
|
139
|
+
"cfn_nag": {
|
|
140
|
+
"rules_to_suppress": [
|
|
141
|
+
{
|
|
142
|
+
"id": "W58",
|
|
143
|
+
"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."
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "W89",
|
|
147
|
+
"reason": "This is not a rule for the general case, just for specific use cases/industries"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"id": "W92",
|
|
151
|
+
"reason": "Impossible for us to define the correct concurrency for clients"
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"testlambdakinesisstreamsKinesisStream11A82116": {
|
|
158
|
+
"Type": "AWS::Kinesis::Stream",
|
|
159
|
+
"Properties": {
|
|
160
|
+
"RetentionPeriodHours": 24,
|
|
161
|
+
"ShardCount": 1,
|
|
162
|
+
"StreamEncryption": {
|
|
163
|
+
"EncryptionType": "KMS",
|
|
164
|
+
"KeyId": "alias/aws/kinesis"
|
|
165
|
+
},
|
|
166
|
+
"StreamModeDetails": {
|
|
167
|
+
"StreamMode": "PROVISIONED"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"testlambdakinesisstreamsKinesisStreamGetRecordsIteratorAgeAlarmC4A0FF00": {
|
|
172
|
+
"Type": "AWS::CloudWatch::Alarm",
|
|
173
|
+
"Properties": {
|
|
174
|
+
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
|
|
175
|
+
"EvaluationPeriods": 1,
|
|
176
|
+
"AlarmDescription": "Consumer Record Processing Falling Behind, there is risk for data loss due to record expiration.",
|
|
177
|
+
"MetricName": "GetRecords.IteratorAgeMilliseconds",
|
|
178
|
+
"Namespace": "AWS/Kinesis",
|
|
179
|
+
"Period": 300,
|
|
180
|
+
"Statistic": "Maximum",
|
|
181
|
+
"Threshold": 43200000
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"testlambdakinesisstreamsKinesisStreamReadProvisionedThroughputExceededAlarm9732E188": {
|
|
185
|
+
"Type": "AWS::CloudWatch::Alarm",
|
|
186
|
+
"Properties": {
|
|
187
|
+
"ComparisonOperator": "GreaterThanThreshold",
|
|
188
|
+
"EvaluationPeriods": 1,
|
|
189
|
+
"AlarmDescription": "Consumer Application is Reading at a Slower Rate Than Expected.",
|
|
190
|
+
"MetricName": "ReadProvisionedThroughputExceeded",
|
|
191
|
+
"Namespace": "AWS/Kinesis",
|
|
192
|
+
"Period": 300,
|
|
193
|
+
"Statistic": "Average",
|
|
194
|
+
"Threshold": 0
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"Parameters": {
|
|
199
|
+
"BootstrapVersion": {
|
|
200
|
+
"Type": "AWS::SSM::Parameter::Value<String>",
|
|
201
|
+
"Default": "/cdk-bootstrap/hnb659fds/version",
|
|
202
|
+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"Rules": {
|
|
206
|
+
"CheckBootstrapVersion": {
|
|
207
|
+
"Assertions": [
|
|
208
|
+
{
|
|
209
|
+
"Assert": {
|
|
210
|
+
"Fn::Not": [
|
|
211
|
+
{
|
|
212
|
+
"Fn::Contains": [
|
|
213
|
+
[
|
|
214
|
+
"1",
|
|
215
|
+
"2",
|
|
216
|
+
"3",
|
|
217
|
+
"4",
|
|
218
|
+
"5"
|
|
219
|
+
],
|
|
220
|
+
{
|
|
221
|
+
"Ref": "BootstrapVersion"
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 lambda = require("aws-cdk-lib/aws-lambda");
|
|
20
|
+
const app = new aws_cdk_lib_1.App();
|
|
21
|
+
const stack = new aws_cdk_lib_1.Stack(app, core_1.generateIntegStackName(__filename));
|
|
22
|
+
const existingLambdaObj = core_1.deployLambdaFunction(stack, {
|
|
23
|
+
code: lambda.Code.fromAsset(`${__dirname}/lambda`),
|
|
24
|
+
runtime: lambda.Runtime.NODEJS_18_X,
|
|
25
|
+
handler: 'index.handler',
|
|
26
|
+
});
|
|
27
|
+
new lib_1.LambdaToKinesisStreams(stack, 'test-lambda-kinesisstreams', {
|
|
28
|
+
existingLambdaObj
|
|
29
|
+
});
|
|
30
|
+
app.synth();
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXhpc3RpbmdMYW1iZGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5leGlzdGluZ0xhbWJkYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7O0dBV0c7O0FBRUgsZ0JBQWdCO0FBQ2hCLDZDQUF5QztBQUN6QyxnQ0FBZ0Q7QUFDaEQseURBQThGO0FBQzlGLGlEQUFpRDtBQUVqRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLDZCQUFzQixDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUM7QUFFakUsTUFBTSxpQkFBaUIsR0FBRywyQkFBb0IsQ0FBQyxLQUFLLEVBQUU7SUFDcEQsSUFBSSxFQUFFLE1BQU0sQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLEdBQUcsU0FBUyxTQUFTLENBQUM7SUFDbEQsT0FBTyxFQUFFLE1BQU0sQ0FBQyxPQUFPLENBQUMsV0FBVztJQUNuQyxPQUFPLEVBQUUsZUFBZTtDQUN6QixDQUFDLENBQUM7QUFFSCxJQUFJLDRCQUFzQixDQUFDLEtBQUssRUFBRSw0QkFBNEIsRUFBRTtJQUM5RCxpQkFBaUI7Q0FDbEIsQ0FBQyxDQUFDO0FBRUgsR0FBRyxDQUFDLEtBQUssRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG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