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.
MQTT connection of the AWS IoT Cloud
The connection takes place in the following steps, which we will explain in detail below.
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):
3. Click on the button “Create a single thing”:
4. Put in a name and maybe you have to scroll down:
5. Click on the button “Next”:
6. Click on the button “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):
8. Choose the menue entry “Secure”:
9. Choose the menue entry “Policies”:
10. Click on the button “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:
Click on the button “Create”:
12. Choose the menue entry “Certificates”:
13. Open the context menue “…” (1) and choose the menue entry “Attach policy” (2):
14. Enable the checkbox “OPCRouter” (1) and click on the button “Attach” (2):
Announcing certificate to the OPC Router
1. Open the menue “Extras” (1) and choose the menue entry “Settings” (2):
2. Click on the third vertical tab “Certificate management”:
3. Click on the tab “Client certificates”:
4. 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):
6. Choose the certificate (1) and click on “Add private key” (2):
7. Choose the downloaded KEY file, see step 7.2 of section “Creating an object and generating a certificate”, (1) and open it (2):
8. Here is your certificate:
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)
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”:
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:
4. The three tabs “Connection properties”, “First will”, “Last will” don’t need to be modified und you agree with the OK button:
5. Finally here is the finished MQTT entry:
Further information
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.
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, …
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.