LambdaFunctionAction

class aws_cdk.aws_iot_actions.LambdaFunctionAction(func)

Bases: object

(experimental) The action to invoke an AWS Lambda function, passing in an MQTT message.

Stability:

experimental

ExampleMetadata:

infused

Example:

func = lambda_.Function(self, "MyFunction",
    runtime=lambda_.Runtime.NODEJS_14_X,
    handler="index.handler",
    code=lambda_.Code.from_inline("""
            exports.handler = (event) => {
              console.log("It is test for lambda action of AWS IoT Rule.", event);
            };""")
)

iot.TopicRule(self, "TopicRule",
    sql=iot.IotSql.from_string_as_ver20160323("SELECT topic(2) as device_id, timestamp() as timestamp, temperature FROM 'device/+/data'"),
    actions=[actions.LambdaFunctionAction(func)]
)
Parameters:

func (IFunction) – The lambda function to be invoked by this action.

Stability:

experimental

Methods

bind(topic_rule)

(experimental) Returns the topic rule action specification.

Parameters:

topic_rule (ITopicRule) –

Stability:

experimental

Return type:

ActionConfig