How to pass SQS attributes when IOT rule is triggered?

0

Basic flow: Multiple clients are pushing data to the single topic which then pushes the same data to SQS after authentication and there's a backend service which is listening to SQS.

For authentication, I've created a custom authorizer. Following is the dummy response from the custom authorizer.

{
    "isAuthenticated": true,
    "refreshAfterInSeconds": 600,
    "policyDocuments": [
        "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"iot:Publish\",\"Effect\":\"Allow\",\"Resource\":\"arn:aws:iot:ap-south-1:test:topic/customauthtesting\"}]}"
    ],
    "disconnectAfterInSeconds": 3600,
    "principalId": "123",
    "context" ": {
         "userId" : "User1"    
    }
}

And I'm able to pass the body(incl. timestamp) to SQS using Rule query statement like this

SELECT *, timestamp() as timestamp FROM 'topic/test'

Now, I want to push the context.userId either as an attribute or in a body to SQS when the same IOT rule is triggered, but I'm unable to do so. It's mentioned in the https://docs.aws.amazon.com/iot/latest/developerguide/custom-authorizer.html that Information derived after validating the token that is made available in AWS IoT rules engine SQL statements, so I think it's feasible to do so.

Can someone please provide me the example or the correct syntax for passing the userId in Rule SQL query. Let me know if more info is required.

Edited by: ShobhitR on Jul 13, 2020 12:19 AM

質問済み 4年前419ビュー
1回答

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ