0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AWSIOT: 既存の Lambda にトリガーをかけるトピックの作成

Last updated at Posted at 2022-11-10

既存の Lambda 関数を lambdatodb とします。

ルールの作成

TESTlambda というルールを作成
トピックは、test/topica

create_rule.sh
aws iot create-topic-rule --rule-name TESTlambda --topic-rule-payload file://new01.json
new01.json
{
        "sql": "SELECT x AS vX,y AS vY,z AS vZ FROM 'test/topica'",
        "ruleDisabled": false,
        "awsIotSqlVersion": "2016-03-23",
        "actions": [
            {
                "lambda": {
                    "functionArn": "arn:aws:lambda:ap-northeast-1:123454806462:function:lambdatodb"
                }
            }
        ]
}

functionArn の調べ方

aws lambda list-functions

実行

./create_rule.sh

ルールの一覧

aws iot list-topic-rules

Lambda にトリガーを追加

Lambda -> 関数 -> lambdatodb
image.png

作成したトピックの動作確認

こちらです。
AWSIOT: AWS CLI で トピックにパブリッシュ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?