aws-solutions-constructs.aws-iot-lambda


Nameaws-solutions-constructs.aws-iot-lambda JSON
Version 2.74.0 PyPI version JSON
download
home_pagehttps://github.com/awslabs/aws-solutions-constructs.git
SummaryCDK Constructs for AWS IoT to AWS Lambda integration
upload_time2024-10-22 18:09:37
maintainerNone
docs_urlNone
authorAmazon Web Services
requires_python~=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aws-iot-lambda module

<!--BEGIN STABILITY BANNER-->---


![Stability: Experimental](https://img.shields.io/badge/stability-Experimental-important.svg?style=for-the-badge)

> 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](https://semver.org/) 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.

---
<!--END STABILITY BANNER-->

| **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
|:-------------|:-------------|

<div style="height:8px"></div>

| **Language**     | **Package**        |
|:-------------|-----------------|
|![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_iot_lambda`|
|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-iot-lambda`|
|![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.iotlambda`|

## Overview

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

Here is a minimal deployable pattern definition:

Typescript

```python
import { Construct } from 'constructs';
import { Stack, StackProps } from 'aws-cdk-lib';
import { IotToLambdaProps, IotToLambda } from '@aws-solutions-constructs/aws-iot-lambda';
import * as lambda from 'aws-cdk-lib/aws-lambda';

const constructProps: IotToLambdaProps = {
  lambdaFunctionProps: {
    code: lambda.Code.fromAsset(`lambda`),
    runtime: lambda.Runtime.NODEJS_16_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(this, 'test-iot-lambda-integration', constructProps);
```

Python

```python
from aws_solutions_constructs.aws_iot_lambda import IotToLambdaProps, IotToLambda
from aws_cdk import (
    aws_iot as iot,
    aws_lambda as _lambda,
    Stack
)
from constructs import Construct

IotToLambda(self, 'test_iot_lambda',
            lambda_function_props=_lambda.FunctionProps(
                code=_lambda.Code.from_asset('lambda'),
                runtime=_lambda.Runtime.PYTHON_3_9,
                handler='index.handler'
            ),
            iot_topic_rule_props=iot.CfnTopicRuleProps(
                topic_rule_payload=iot.CfnTopicRule.TopicRulePayloadProperty(
                    rule_disabled=False,
                    description="Sends data to kinesis data stream",
                    sql="SELECT * FROM 'solutions/construct'",
                    actions=[]
                )
            ))
```

Java

```java
import software.constructs.Construct;
import java.util.List;

import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.services.lambda.Runtime;
import software.amazon.awscdk.services.iot.*;
import software.amazon.awscdk.services.iot.CfnTopicRule.TopicRulePayloadProperty;
import software.amazon.awsconstructs.services.iotlambda.*;

new IotToLambda(this, "test-iot-lambda-integration", new IotToLambdaProps.Builder()
        .lambdaFunctionProps(new FunctionProps.Builder()
                .runtime(Runtime.NODEJS_16_X)
                .code(Code.fromAsset("lambda"))
                .handler("index.handler")
                .build())
        .iotTopicRuleProps(new CfnTopicRuleProps.Builder()
                .topicRulePayload(new TopicRulePayloadProperty.Builder()
                        .ruleDisabled(false)
                        .description("Processing of DTC messages from the AWS Connected Vehicle Solution.")
                        .sql("SELECT * FROM 'connectedcar/dtc/#'")
                        .actions(List.of())
                        .build())
                .build())
        .build());
```

## Pattern Construct Props

| **Name**     | **Type**        | **Description** |
|:-------------|:----------------|-----------------|
|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.|
|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.|
|iotTopicRuleProps?|[`iot.CfnTopicRuleProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iot.CfnTopicRuleProps.html)|User provided CfnTopicRuleProps to override the defaults|

## Pattern Properties

| **Name**     | **Type**        | **Description** |
|:-------------|:----------------|-----------------|
|iotTopicRule|[`iot.CfnTopicRule`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iot.CfnTopicRule.html)|Returns an instance of iot.CfnTopicRule created by the construct|
|lambdaFunction|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Returns an instance of lambda.Function created by the construct|

## Default settings

Out of the box implementation of the Construct without any override will set the following defaults:

### Amazon IoT Rule

* Configure least privilege access IAM role for Amazon IoT

### AWS Lambda Function

* Configure limited privilege access IAM role for Lambda function
* Enable reusing connections with Keep-Alive for NodeJs Lambda function
* Enable X-Ray Tracing
* Set Environment Variables

  * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)

## Architecture

![Architecture Diagram](architecture.png)

---


© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/awslabs/aws-solutions-constructs.git",
    "name": "aws-solutions-constructs.aws-iot-lambda",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Amazon Web Services",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/24/25/a98b7d3a5cc506fa9b112ae0f9aeaac425b92249b64515d7f677b8ec88ae/aws_solutions_constructs_aws_iot_lambda-2.74.0.tar.gz",
    "platform": null,
    "description": "# aws-iot-lambda module\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![Stability: Experimental](https://img.shields.io/badge/stability-Experimental-important.svg?style=for-the-badge)\n\n> All classes are under active development and subject to non-backward compatible changes or removal in any\n> future version. These are not subject to the [Semantic Versioning](https://semver.org/) model.\n> 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.\n\n---\n<!--END STABILITY BANNER-->\n\n| **Reference Documentation**:| <span style=\"font-weight: normal\">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|\n|:-------------|:-------------|\n\n<div style=\"height:8px\"></div>\n\n| **Language**     | **Package**        |\n|:-------------|-----------------|\n|![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_iot_lambda`|\n|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-iot-lambda`|\n|![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.iotlambda`|\n\n## Overview\n\nThis AWS Solutions Construct implements an AWS IoT MQTT topic rule and an AWS Lambda function pattern.\n\nHere is a minimal deployable pattern definition:\n\nTypescript\n\n```python\nimport { Construct } from 'constructs';\nimport { Stack, StackProps } from 'aws-cdk-lib';\nimport { IotToLambdaProps, IotToLambda } from '@aws-solutions-constructs/aws-iot-lambda';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\n\nconst constructProps: IotToLambdaProps = {\n  lambdaFunctionProps: {\n    code: lambda.Code.fromAsset(`lambda`),\n    runtime: lambda.Runtime.NODEJS_16_X,\n    handler: 'index.handler'\n  },\n  iotTopicRuleProps: {\n    topicRulePayload: {\n      ruleDisabled: false,\n      description: \"Processing of DTC messages from the AWS Connected Vehicle Solution.\",\n      sql: \"SELECT * FROM 'connectedcar/dtc/#'\",\n      actions: []\n    }\n  }\n};\n\nnew IotToLambda(this, 'test-iot-lambda-integration', constructProps);\n```\n\nPython\n\n```python\nfrom aws_solutions_constructs.aws_iot_lambda import IotToLambdaProps, IotToLambda\nfrom aws_cdk import (\n    aws_iot as iot,\n    aws_lambda as _lambda,\n    Stack\n)\nfrom constructs import Construct\n\nIotToLambda(self, 'test_iot_lambda',\n            lambda_function_props=_lambda.FunctionProps(\n                code=_lambda.Code.from_asset('lambda'),\n                runtime=_lambda.Runtime.PYTHON_3_9,\n                handler='index.handler'\n            ),\n            iot_topic_rule_props=iot.CfnTopicRuleProps(\n                topic_rule_payload=iot.CfnTopicRule.TopicRulePayloadProperty(\n                    rule_disabled=False,\n                    description=\"Sends data to kinesis data stream\",\n                    sql=\"SELECT * FROM 'solutions/construct'\",\n                    actions=[]\n                )\n            ))\n```\n\nJava\n\n```java\nimport software.constructs.Construct;\nimport java.util.List;\n\nimport software.amazon.awscdk.Stack;\nimport software.amazon.awscdk.StackProps;\nimport software.amazon.awscdk.services.lambda.*;\nimport software.amazon.awscdk.services.lambda.Runtime;\nimport software.amazon.awscdk.services.iot.*;\nimport software.amazon.awscdk.services.iot.CfnTopicRule.TopicRulePayloadProperty;\nimport software.amazon.awsconstructs.services.iotlambda.*;\n\nnew IotToLambda(this, \"test-iot-lambda-integration\", new IotToLambdaProps.Builder()\n        .lambdaFunctionProps(new FunctionProps.Builder()\n                .runtime(Runtime.NODEJS_16_X)\n                .code(Code.fromAsset(\"lambda\"))\n                .handler(\"index.handler\")\n                .build())\n        .iotTopicRuleProps(new CfnTopicRuleProps.Builder()\n                .topicRulePayload(new TopicRulePayloadProperty.Builder()\n                        .ruleDisabled(false)\n                        .description(\"Processing of DTC messages from the AWS Connected Vehicle Solution.\")\n                        .sql(\"SELECT * FROM 'connectedcar/dtc/#'\")\n                        .actions(List.of())\n                        .build())\n                .build())\n        .build());\n```\n\n## Pattern Construct Props\n\n| **Name**     | **Type**        | **Description** |\n|:-------------|:----------------|-----------------|\n|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.|\n|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.|\n|iotTopicRuleProps?|[`iot.CfnTopicRuleProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iot.CfnTopicRuleProps.html)|User provided CfnTopicRuleProps to override the defaults|\n\n## Pattern Properties\n\n| **Name**     | **Type**        | **Description** |\n|:-------------|:----------------|-----------------|\n|iotTopicRule|[`iot.CfnTopicRule`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iot.CfnTopicRule.html)|Returns an instance of iot.CfnTopicRule created by the construct|\n|lambdaFunction|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Returns an instance of lambda.Function created by the construct|\n\n## Default settings\n\nOut of the box implementation of the Construct without any override will set the following defaults:\n\n### Amazon IoT Rule\n\n* Configure least privilege access IAM role for Amazon IoT\n\n### AWS Lambda Function\n\n* Configure limited privilege access IAM role for Lambda function\n* Enable reusing connections with Keep-Alive for NodeJs Lambda function\n* Enable X-Ray Tracing\n* Set Environment Variables\n\n  * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)\n\n## Architecture\n\n![Architecture Diagram](architecture.png)\n\n---\n\n\n\u00a9 Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "CDK Constructs for AWS IoT to AWS Lambda integration",
    "version": "2.74.0",
    "project_urls": {
        "Homepage": "https://github.com/awslabs/aws-solutions-constructs.git",
        "Source": "https://github.com/awslabs/aws-solutions-constructs.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b9bc41b79af279a83e499a8b290523d2b0d257c3998be013b54811a33fe1ce70",
                "md5": "6025968a499da87277b9788f38c5cdb9",
                "sha256": "78e91828a4eef4964d7dde862cb252b1240b1f33c86c48022d999f4ccf3e6a4d"
            },
            "downloads": -1,
            "filename": "aws_solutions_constructs.aws_iot_lambda-2.74.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6025968a499da87277b9788f38c5cdb9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 94780,
            "upload_time": "2024-10-22T18:08:00",
            "upload_time_iso_8601": "2024-10-22T18:08:00.783510Z",
            "url": "https://files.pythonhosted.org/packages/b9/bc/41b79af279a83e499a8b290523d2b0d257c3998be013b54811a33fe1ce70/aws_solutions_constructs.aws_iot_lambda-2.74.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2425a98b7d3a5cc506fa9b112ae0f9aeaac425b92249b64515d7f677b8ec88ae",
                "md5": "b73de3e95560179526a1c78dea61ce50",
                "sha256": "06527bfb5f5cdd117e3c9a55c658b2214083b081adfa9133588af7e6994ef2c6"
            },
            "downloads": -1,
            "filename": "aws_solutions_constructs_aws_iot_lambda-2.74.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b73de3e95560179526a1c78dea61ce50",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 96014,
            "upload_time": "2024-10-22T18:09:37",
            "upload_time_iso_8601": "2024-10-22T18:09:37.394714Z",
            "url": "https://files.pythonhosted.org/packages/24/25/a98b7d3a5cc506fa9b112ae0f9aeaac425b92249b64515d7f677b8ec88ae/aws_solutions_constructs_aws_iot_lambda-2.74.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-22 18:09:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "awslabs",
    "github_project": "aws-solutions-constructs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aws-solutions-constructs.aws-iot-lambda"
}
        
Elapsed time: 0.41334s