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?

질문됨 2년 전268회 조회
1개 답변
1
수락된 답변

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

답변함 2년 전
  • 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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠