How To Configure AWS IoT Core Integration

KHM-049-00.png

Description

AWS IoT Core Integration is a software service that enables your LoRaWAN gateway to work with AWS IoT Core. This document will show you how to set up a LoRaWAN end-node and view its data on the AWS IoT Console. In addition, it’ll show you how to send a message from AWS IoT Console to the end-node as well.

Prerequisites

  • A gateway from the RAK WisGate Edge series
  • A node from the RAK WisNode or WisBlock series, or another LoRaWAN compatible node
  • An AWS account
đź“ť NOTE: For this tutorial, the RAK7200 WisNode Track Lite is used as the end-node and RAK7268 WisGate Edge Lite 2 for the gateway.

Set Up Environment for Evaluation

Set Up the Built-in Network Server

All the WisGate Edge Gateways are pre-configured in the Network Server mode of operation. If you want some modifications, creating the application and adding the device needed for this demonstration, refer to the Built in LoRa Server tutorial. It shows the detailed way on how to configure your gateway.

Integrate AWS IoT Core

AWS IoT Core is a cloud-based service that connects your "things" (devices, sensors, etc.) to other devices and AWS cloud services. AWS IoT provides software that can help you integrate your IoT devices into AWS IoT-based solutions. If your devices can connect to AWS IoT, the AWS IoT can connect them to the cloud services that AWS provides.

Create a Thing

To create a thing (add a device) in the AWS IoT console, navigate to Manage > Things and select Create Things.

KHM-049-01.png

You can choose to add a single device or multiple ones. For this demonstration, select Create single thing and click Next.

KHM-049-02.png

Give your thing a name and click Next.

KHM-049-03.png

To generate certificates for your thing, select the Auto-generate a new certificate (recommended) and click Next.

KHM-049-04.png

A policy is needed for your thing, hence click Create policy.

KHM-049-05.png

You’ll be automatically redirected to a new window. Click Secure then Policies.

KHM-049-06.png

Fill in the following fields, then click Create.

  • Name: A name for your policy. For this example, the name will be My_policy.
  • Action: Type iot:*
  • Resource ARN: Type *
  • Effect: Mark Allow.

Return to the previous window and refresh it by clicking the Refresh button. You will then see the newly created policy pop up in the list. Choose it and click Create Thing.

KHM-049-07.png

In the opened window, download all the certificates and keys, then click Done.

⚠️ WARNING: Save the downloaded certificates and keys, as they cannot be downloaded again if needed.

KHM-049-08.png

Your thing is created. Now, you need to attach the policy you’ve created to it. Click on the name of your thing and navigate to Certificates.

KHM-049-09.png

KHM-049-010.png

Click on the Certificate ID. In the Actions drop-down menu, choose Attach policy.

KHM-049-011.png

Select the previously created policy and click Attach.

KHM-049-012.png

Configure Global Integration for the AWS Proxy

Now, you need to configure the global integration of the gateway for the AWS IoT Core. To do so, in the gateway's Web UI, navigate to LoRa Network > Global Integration. Then choose AWS IoT Core for the Integration Mode.

KHM-049-013.png

Fill in the following information:

  • AWS URL - The URL for your things can be found in the Settings menu under the Endpoint in the AWS IoT console.

KHM-049-014.png

  • AWS Port – The port for the AWS IoT core. Fill the field with port 8883.
  • CA Certificate – The certificate you've downloaded (see Figure 15).
  • Vendor Certificate – The certificate you've downloaded (see Figure 15).
  • Vendor Key – The key you've downloaded (see Figure 15).

KHM-049-015.png

Verify a Successful Integration

See messages from the device in the AWS IoT console

To see the messages from the end-node, navigate to the Test tab in the AWS IoT console.

KHM-049-016.png

In the Topic filter field, subscribe to all topics by typing # to see the data (join, uplink, downlinks, etc.) from the node.

KHM-049-017.png

RAKwireless provides a decoder for all WisNode devices that are based on RUI. All WisNode devices support Cayenne LPP payload format, and it can be activated via the Web UI of the gateway. Navigate to LoRa Network > Application > Your_application > Edit > Payload Formats.

In the Payload Format drop-down menu, choose Cayenne LPP, then enable Only forward the parsed data object to receive only the data of the sensor. Click Save & Apply.

KHM-049-018.png

Send Messages to the Device

To send messages to the end-node, in the AWS IoT console, navigate to Test > Publish to a Topic.

Here you need to fill in the following:

  • Topic Name – The name of the topic to which you want to publish a message. Here is a template of the downlink topic the RAK Gateway uses application/id/device/eui/tx, where:
    • id – This is the ID of your application. It can be found in the LoRa Network > Application tab of the gateway’s UI.
    • eui – This is the device’s EUI.

An example of a downlink topic would be application/6/device/60c5a8fffeXXXXXX/tx.

  • Message Payload – The message that you want to send to the end-node. It must be in the format {"confirmed":true,"data":"SGVsbG8=","fPort":10}, where:
    • Confirmed can be true or false.
    • The content of the data is the information you want to send. The information must be base64 encoded. This can be done with a converter.
    • fPort is the port number where you send the data. The number can be 1-255.

You can send the message by clicking Publish.

KHM-049-019.png

The message can be seen in the Live Device Data of the node in the Web UI of the gateway.

KHM-049-020.png

Updated