AWS MQTT cloud connection: Difference between revisions

From Teltonika Networks Wiki
No edit summary
No edit summary
Line 8: Line 8:


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


Line 22: Line 22:


=== Certificate Handling ===
=== Certificate Handling ===
You will be prompted to download the certificates, those will be used by Publishers and Subscribers to connect to your AWS MQTT Broker, download the "Device certificate",  "Private key file,  "Public key file" and "Amazon Root CA 1".
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".
[[File:Image985.png|none|thumb|478x478px]]
[[File:Image985.png|none|thumb|478x478px]]


Line 29: Line 31:


=== Setting up policies ===
=== 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"
Go back to the AWS IoT HuB, open the "Secure" tab and click on "Policies"
[[File:Image8754.png|none|thumb|523x523px]]
[[File:Image8754.png|none|thumb|523x523px]]


Do the following procedure: Click on "Create policy" -> Give it a name
Do the following procedure: Click on "Create policy" -> Give it a name -> Policy effect: allow -> Policy action: * -> Policy resource: *-> Create
[[File:Image854.png|none|thumb|799x799px]]
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".
[[File:Image5422.png|none|thumb|807x807px]]
Then select the policy you've created previously, and click on "Attach policies"
[[File:Image471.png|none|thumb|479x479px]]
 
=== 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.
[[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.

Revision as of 15:22, 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:

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".

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:

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"

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

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".

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

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.

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