> **Experimental**
>
> `@aws-cdk/aws-iot-actions-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# LambdaFunctionAction

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

Extends: LambdaFunctionAction
Implements: IAction

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/lambda-function-action.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-iot-actions-alpha/lib/lambda-function-action.ts#L9)

## Example

```ts
const func = new lambda.Function(this, 'MyFunction', {
  runtime: lambda.Runtime.NODEJS_LATEST,
  handler: 'index.handler',
  code: lambda.Code.fromInline(`
    exports.handler = (event) => {
      console.log("It is test for lambda action of AWS IoT Rule.", event);
    };`
  ),
});

new iot.TopicRule(this, 'TopicRule', {
  sql: iot.IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, timestamp() as timestamp, temperature FROM 'device/+/data'"),
  actions: [new actions.LambdaFunctionAction(func)],
});
```

## Initializer

```ts
new LambdaFunctionAction(func: IFunction)
```
