简体   繁体   English

适用于Lambda操作问题的AWS Iot规则触发器

[英]AWS iot rule trigger for lambda action issue

I am creating AWS IOT rule using sdk from my code with lambda function as action. 我正在使用lambda函数作为操作从代码中使用sdk创建AWS IOT规则。 Rule is getting created successfully, but its not getting triggered. 规则已成功创建,但未触发。 It will start getting triggered only after I go the the UI page select the action and click on update button on the right hand side. 仅在我进入UI页面选择操作并单击右侧的“更新”按钮后,它才会开始被触发。

Any help to resolve the issue will be helpfull. 解决该问题的任何帮助将是有帮助的。

I faced this problem today, this is my solution. 我今天遇到了这个问题,这是我的解决方案。

You need to add permission to your target lambda, you can create a lambda, then run this code. 您需要向目标Lambda添加权限,您可以创建Lambda,然后运行此代码。 You need change the functionName first. 您需要先更改functionName。 Then go your target Lambda function and click the permission, you will see the permission in your left side. 然后转到目标Lambda函数并单击权限,您将在左侧看到该权限。

response = client.add_permission(
 FunctionName='Lambda_Name',
 StatementId='FunctionPermission',
 Action='lambda:InvokeFunction',
 Principal="iot.amazonaws.com",
 SourceAccount = "yourAccount")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM