How to post a DeviceEUI to a IoT topic?

0

I have several Wireless/LoRa devices with their own DeviceId and DevEui identifiers. I have them routing their uplinks to a vanilla topic like devices/lorawan/uplink.

But I'd like them to post their uplinks on their own subtopic using their DevEui or DeviceId.

e.g. devices/lorawan/ab123fffe4567890/uplinks

I assume this is done using a Wireless destination, but it's not clear what the variable is when configuring the topic inside the destination settings. Something likedevices/lorawan/${WirelessMetadata.DevEui}/uplinks?

asked 2 years ago259 views
1 Answer
1
Accepted Answer

Hi,

my proposed approach is to follow these steps:

  1. Point a Wireless Destination to an AWS IoT Rule (let's call it ProcessLoRaWANUplink)
  2. Use the following IoT SQL:
SELECT *
  1. Add "Republish" action and specify a topic as following:
 devices/lorawan/${WirelessMetadata.LoRaWAN.DevEui}/uplinks

Please notice:

  • You should double-check that including metadata is enabled in the Service Profile you assigned to the LoRaWAN device
  • Double-Check that IAM Role assigned to the "Republish" action us allowing "iot:Publish" to "devices/lorawan/*". In this specific case, I recommend not to use "Create role" option when creating an Action the Management Console, but create a role using AWS IAM Management Console, using the following trust relationship:
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "iot.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

and the following policy:

{
    "Version": "2012-10-17",
    "Statement": {
        "Effect": "Allow",
        "Action": "iot:Publish",
        "Resource": "arn:aws:iot:<Region e.g. eu-west-1>:<Account id>:topic/devices/lorawan/*"
    }
}

best regards, Andrei

answered 2 years ago
  • Thank you! Got it working. Question though, is there any kind of scalability / pricing penalty for republishing which is effectively doubling the number of messages on the broker?

  • Short answer is: yes, there will be price impact and no, there are no scalability concerns I see here.

    Long answer: The IoT Core Message broker is not involved if you "just" specify an IoT Rule in your Wireless Destination. In such case you are billed "only" for the IoT Rules invocations and Actions executions.

    If you follow the approach proposed in my reply, you will additionally be billed for a/ Repbulishing action b/ IoT IoT Core Message broker publishing.

    Based on my experience I recommend to look to the actual cost estimation (https://aws.amazon.com/iot-core/pricing/), especially for LoRaWAN devices that typically ingest only few times a day / hour.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions