aws-iot-lambda - AWS Solutions Constructs


All classes are under active development and subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.

Language Package

This AWS Solutions Constructs pattern implements an AWS IoT MQTT topic rule and an AWS Lambda function pattern.

Here is a minimal deployable pattern definition:

const { IotToLambdaProps, IotToLambda } = require('@aws-solutions-constructs/aws-iot-lambda'); const props: IotToLambdaProps = { lambdaFunctionProps: { code: lambda.Code.asset(`${__dirname}/lambda`), runtime: lambda.Runtime.NODEJS_10_X, handler: 'index.handler' }, iotTopicRuleProps: { topicRulePayload: { ruleDisabled: false, description: "Processing of DTC messages from the AWS Connected Vehicle Solution.", sql: "SELECT * FROM 'connectedcar/dtc/#'", actions: [] } } }; new IotToLambda(stack, 'test-iot-lambda-integration', props);


new IotToLambda(scope: Construct, id: string, props: IotToLambdaProps);


Pattern Construct Props

Name Type Description
existingLambdaObj? lambda.Function An optional, existing Lambda function to be used instead of the default function. If an existing function is provided, the lambdaFunctionProps property will be ignored.
lambdaFunctionProps? lambda.FunctionProps Optional user-provided properties to override the default properties for the Lambda function. Ignored if an existingLambdaObj is provided.
iotTopicRuleProps? iot.CfnTopicRuleProps User provided CfnTopicRuleProps to override the defaults

Pattern Properties

Name Type Description
iotTopicRule iot.CfnTopicRule Returns an instance of the IoT topic rule created by the pattern.
lambdaFunction lambda.Function Returns an instance of the Lambda function created by the pattern.

Default settings

Out-of-the-box implementation of this pattern without any overrides will set the following defaults:

Amazon IoT Rule

  • Configure least privilege access IAM role for Amazon IoT

AWS Lambda Function

  • Configure least privilege access IAM role for Lambda function

  • Enable reusing connections with Keep-Alive for NodeJs Lambda function