Difference between revisions of "AWS MQTT cloud connection"

From Teltonika Networks Wiki
Line 49: Line 49:
 
[[File:Image4785.png|none|thumb|405x405px]]
 
[[File:Image4785.png|none|thumb|405x405px]]
 
With that, your MQTT Broker is all setup, and you can start setting up your RUT router as a Publisher.
 
With that, your MQTT Broker is all setup, and you can start setting up your RUT router as a Publisher.
 +
=RUT as MQTT Publisher=
 +
 +
=== What data do you want to publish? ===
 +
Depending on your RUT model, you can have the following options of data sources to send over MQTT:
 +
 +
* Bluetooth
 +
* Wifi scanner
 +
* MODBUS
 +
* Router monitoring

Revision as of 23:47, 26 May 2022

Main Page > General Information > Configuration Examples > Third party services > IoT platforms > AWS MQTT cloud connection

Introduction

In this article you will find instructions on how to setup AWS IoT as a MQTT Broker and how to setup a RUT router as a MQTT Publisher and send data over to this AWS Broker.

With that, you will be able to configure any other device as a MQTT Subscriber, and listen to any published info by the router or other devices on this same broker.

Prerequisites

You will need:

  • An AWS account
  • A router from the RUT2xx or RUT9xx or RUTXxx series
  • A computer with mosquitto application (optional)

Setting up AWS IoT

Creating a thing

First off, open the AWS Management Console and login with your credentials. After that, you will see a screen similar to this:

Image987.png

On the search bar on the top, search for "IoT Core", and click on the first search result. You will see a screen like the one below, open the "Manage" section and click on "Things".

Then, do the following procedure to create a Thing: click on the "Create Things" button -> "Create single thing" -> Give it any name -> "No shadow" -> "Auto-generate a new certificate (recommended)" -> "Create thing".

Certificate Handling

Certificates are used by Publishers and Subscribers to connect to your AWS MQTT Broker.

You will be prompted to download the certificates, download the "Device certificate", "Private key file, "Public key file" and "Amazon Root CA 1".

Image985.png

Move all the 4 files to a folder on the C:\ drive, so it's easy to locate them. Then, i'd recommend renaming them as following: Keep the "AmazonRootCA1.pem" as it is, the file xxxxx.pem.crt as device_certificate.pem.crt, the file xxxxx-private.pem.key as private_key.pem.key and the file xxxxx-public.pem.key as public_key.pem.key. After that, you will have the following:

Image874.png

Setting up policies

The policies are needed for allowing incoming data into AWS.

Go back to the AWS IoT HuB, open the "Secure" tab and click on "Policies"

Image8754.png

Do the following procedure: Click on "Create policy" -> Give it a name -> Policy effect: allow -> Policy action: * -> Policy resource: *-> Create

Image854.png

Then, on the same "Secure" tab, click on certificates. There you will see one certificate, the one you've created, select it by checking the checkbox, then go to "Actions", and click on "Attach policy".

Image5422.png

Then select the policy you've created previously, and click on "Attach policies"

Image471.png

Getting your endpoint

The endpoint is the host address of your MQTT Broker, where Publishers and Subscribers will connect to.

You can find it into the "Settings" tab, copy and save it somewhere.

Image4785.png

With that, your MQTT Broker is all setup, and you can start setting up your RUT router as a Publisher.

RUT as MQTT Publisher

What data do you want to publish?

Depending on your RUT model, you can have the following options of data sources to send over MQTT:

  • Bluetooth
  • Wifi scanner
  • MODBUS
  • Router monitoring