AWS MQTT cloud connection: Difference between revisions
no edit summary
No edit summary |
No edit summary |
||
Line 14: | Line 14: | ||
=== '''Creating a thing''' === | === '''Creating a thing''' === | ||
[[File:Image9876.png|alt=|border|862x862px]] | [[File:Image9876.png|alt=|border|class=tlt-border|862x862px]] | ||
First off, open the [https://aws.amazon.com/pt/console/ AWS Management Console] and login with your credentials. After that, you will see a screen similar to this: | First off, open the [https://aws.amazon.com/pt/console/ AWS Management Console] and login with your credentials. After that, you will see a screen similar to this: | ||
Line 28: | Line 28: | ||
You will be prompted to download the certificates, download the "Device certificate", "Private key file, "Public key file" and "Amazon Root CA 1". | 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| | [[File:Image985.png|border|class=tlt-border|478x478px]] | ||
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: | 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: | ||
[[File:Image874.png| | [[File:Image874.png|border|class=tlt-border|406x406px]] | ||
===Setting up policies=== | ===Setting up policies=== | ||
Line 37: | Line 37: | ||
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| | [[File:Image8754.png|border|class=tlt-border|523x523px]] | ||
Do the following procedure: Click on "Create policy" -> Give it a name -> Policy effect: allow -> Policy action: * -> Policy resource: *-> Create | Do the following procedure: Click on "Create policy" -> Give it a name -> Policy effect: allow -> Policy action: * -> Policy resource: *-> Create | ||
[[File:Image854.png| | [[File:Image854.png|border|class=tlt-border|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". | 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| | [[File:Image5422.png|border|class=tlt-border|807x807px]] | ||
Then select the policy you've created previously, and click on "Attach policies" | Then select the policy you've created previously, and click on "Attach policies" | ||
[[File:Image471.png| | [[File:Image471.png|border|class=tlt-border|479x479px]] | ||
===Getting your endpoint=== | ===Getting your endpoint=== | ||
Line 50: | Line 50: | ||
You can find it into the "Settings" tab, copy and save it somewhere. | You can find it into the "Settings" tab, copy and save it somewhere. | ||
[[File:Image4785.png| | [[File:Image4785.png|border|class=tlt-border|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= | =RUT as MQTT Publisher= | ||
Line 72: | Line 72: | ||
Then, you will use the "Data to server" functionality, under "Services" menu. | Then, you will use the "Data to server" functionality, under "Services" menu. | ||
[[File:Image451.png| | [[File:Image451.png|border|class=tlt-border|470x470px]] | ||
Click on the "Add" button on the right side of the page, you will see the following menu. | Click on the "Add" button on the right side of the page, you will see the following menu. | ||
[[File:Img4587.png| | [[File:Img4587.png|border|class=tlt-border|782x782px]] | ||
The main fields you have to fill up are pretty straight forward, just pay more attention for the fields needed for AWS MQTT Broker connection: | The main fields you have to fill up are pretty straight forward, just pay more attention for the fields needed for AWS MQTT Broker connection: | ||
Line 90: | Line 90: | ||
After setting up all, you should have something similar to the screen below. Click on save and apply. | After setting up all, you should have something similar to the screen below. Click on save and apply. | ||
[[File:Config421.png| | [[File:Config421.png|border|class=tlt-border|749x749px]] | ||
To check if your setup is working, you can use any MQTT client, and subscribe to the topic you've created, you should be able to see the data of the source you've selected. In the image below, i've used the AWS IoT mqtt test client to subscribe to the topic that the router was publishing. | To check if your setup is working, you can use any MQTT client, and subscribe to the topic you've created, you should be able to see the data of the source you've selected. In the image below, i've used the AWS IoT mqtt test client to subscribe to the topic that the router was publishing. | ||
[[File:Image4752.png| | [[File:Image4752.png|border|class=tlt-border|961x961px]] | ||
=Example: Publishing RUT MODBUS data over MQTT= | =Example: Publishing RUT MODBUS data over MQTT= |