How can a data source be connected to Amazon’s AWS IoT Cloud via MQTT? We guide you step by step using OPC Router as MQTT client.

The Amazon AWS Cloud is one of the leading cloud environments on the market. Like all platforms, AWS offers an IoT environment (AWS IoT) in which objects can be created. As it is often the case in IoT, the objects are linked to the field via MQTT. The OPC Router with its MQTT client plug-in thus becomes a possible data supplier for AWS IoT objects. For this purpose, the OPC Router obtains data from various sources with its plug-ins and transfers it bidirectionally to the cloud services.

AWS IoT Cloud MQTT Connection

MQTT connection of the AWS IoT Cloud

The connection takes place in the following steps, which we will explain in detail below.

  1. Creating an object and generating a certificate
  2. Announcing certificate to the OPC Router
  3. Finding out the object address
  4. Creating a MQTT plugin
  5. Transfer data to the object
  6. Monitoring

Creating an object and generating a certificate

1. Login to the AWS portal: https://eu-central-1.console.aws.amazon.com/iot/home?region=eu-central-1#/thinghub

2. Choose the menue entry “Manage/Things” (1) and click on the button “Register a thing” (2):

Registering an object

3. Click on the button “Create a single thing”:

Create a single thing

4. Put in a name and maybe you have to scroll down:

Create a name

5. Click on the button “Next”:

Click on the button Next

6. Click on the button “Create certificate”:

Create certificate

7. Download the certificate in the form of a CRT file (1) and the private key in the form of a KEY file (2), click on the button “Activate” (3) and finally click on the button “Done” (4):

Download certificate

8. Choose the menue entry “Secure”:

menue entry Secure

9. Choose the menue entry “Policies”:

menue entry Policies

10. Click on the button “Create a policy”:

Create a policy

11. Put in a name (1), enter the action “iot:*” (2) and the resource ARN “*” (3), enable the checkbox “Allow” (4) and maybe you have to scroll down:

Add statements

Click on the button “Create”:

Click on the button Create

12. Choose the menue entry “Certificates”:

menue entry Certificates

13. Open the context menue “…” (1) and choose the menue entry “Attach policy” (2):

Attach policy

14. Enable the checkbox “OPCRouter” (1) and click on the button “Attach” (2):

Attach policies to certificates

Announcing certificate to the OPC Router

1. Open the menue “Extras” (1) and choose the menue entry “Settings” (2):

menue entry Settings

2. Click on the third vertical tab “Certificate management”:

Certificate management

3. Click on the tab “Client certificates”:

Client certificates

4. Click “Import”:

Click Import

5. Choose the downloaded CRT file, see step 7.1 of section “Creating an object and generating a certificate”, (1) and open it (2):

Choose CRT file

6. Choose the certificate (1) and click on “Add private key” (2):

Add private key

7. Choose the downloaded KEY file, see step 7.2 of section “Creating an object and generating a certificate”, (1) and open it (2):

Choose Key file

8. Here is your certificate:

Finished certificate

Finding out the object address

1. Choose the menue entry “Manage”:

menue entry Manage

2. Click on your object:

Click on your object

3. Choose the menue entry “Interact”:

menue entry Interact

4. First copy the selected Rest API endpoint to the clipboard and then click on the back button in the upper left corner:

Copy selected Rest API endpoint

Creating a MQTT Plug-in

1. Do following steps in the OPC Router:

  • Click “Plugins” (1)
  • Click “MQTT” under “Cloud / IoT” (2)
  • Click on the Button to create a MQTT plugin (3)

MQTT Settings

2. Put in the following data on tab “Router configuration”:

  • Name (1)
  • Cloud profile (2)
  • The Cloud Profile makes it easier for you to enter the AWS-specific connection data for the MQTT connection.

After that click on tab “AWS”:

Router configuration

3. Do following steps on tab “AWS”:

  • Put in the API endpoint address (1) (see step 4 of section “Finding out the object address”)
  • Choose existing certificate (2)
  • Check the connection (3)

After that click on the tab “Connection properties” to have a look:

Settings AWS

4. The three tabs “Connection properties”, “First will”, “Last will” don’t need to be modified und you agree with the OK button:

Connection properties

First will

Last will

5. Finally here is the finished MQTT entry:

Finished MQTT entry

Transfer data to the object

Here is an example for the transfer of temperature data:

Example for transfer of temperature data

Monitoring

1. Choose the menue entry “Test”:

menue entry Test

2. Enter the subscription topic to be observed and click on the button “Subscripe to topic” (2):

Subscripe to topic

3. Here you can see the transferred results:

transferred results

Further information

OPC Router MQTT Plug-in

Learn how to use the MQTT Client as a connector for MQTT data exchange with systems like SQL, SAP, OPC, REST, SOAP, printer, and many more on our plug-in page.

OPC Router REST Plug-in

Read how you can easily connect different systems with our OPC Router REST Plug-in and that with a graphical user interface. Various systems can be connected such as SQL, OPC UA, SOAP, MQTT, SAP, …

OPC Router MongoDB Plug-in

Learn now how you can realize an easy integration with the OPC Router and the MongoDB Client Plug-in. MongoDB is currently the most widely used NoSQL database.

AWS IoT Cloud connection by Drag & Drop!

With the OPC Router you connect your graphical production systems with the AWS Cloud via MQTT.