Serverless configuration for IoT rules, SQS Topic and Lambda function


I am using Serverless framework.

I have written a rule for the MQTT topic. When a message is published on a MQTT topic by the device, I extract the required fields from the message payload and trigger a Lambda functions.
This works perfectly file.

Here is the serverless configuration snippet for the same.

handler: bin/handlers/LambdafunctionName
- “/
- ./bin/handlers/LambdafunctionName
- iot:
name: “iotRuleName”
sql: “select field1, field2 from ‘/my/mqtt/topicname’”
description: “Rule description”

I want to convert this synchronous event processing to Asynchronous mode,.

From the AWS console, I have created another rule for IoT, wherein the message coming to MQTT broker is published to the SQS queue. Then I have configured a Lambda function which gets triggered when a message is published to the SQS queue.

This also works fine.

I want to configure this IoT Rule, SQS Queue and the Lambda function at the time of deployment using the serverless.yml file.

Are there any sample configuration files, which provide the example of this setup? IoT Topic -> IoT rule -> SQS Queue -> Lambda invocation.

So far the example I have seen only show the configuration for SQS and lambda functions only.