AWS Part 2 - Setting a AWS IoT Core connection
This section describes setting up deviceWISE to communicate with the created thing in AWS Part 1 - Setting up AWS IoT.
AWS Cloud Connection
- Open the Workbench.
- Select the node you want to connect to AWS.
- Under Administration > Packages, make sure the AWS IoT Core extension is added. For more information on installing an extension, see Packages.
- Go to the Staging Browser and upload the three files (certificate, private key, and root CA certificate) you downloaded in AWS Part 1 - Setting up AWS IoT.
- On the Administration>Amazon IoT Core tab, enter the following:
- Enter the Hostname of the device. To get the hostname, go to the AWS IoT Console and click on the NewThing you created, then click on Interact
- Enter the exact name of new device in Client Id, that you created in the AWS Part 1 - Setting up AWS IoT.
- Click beside Sever Certificate, browse and select the Server Certificate saved in the Staging browser.
- Click beside Thing Certificate, to browse and select the Certificate of the thing saved in the Staging browser.
- Click beside Thing Private Key, to browse and select the Device Private key saved in the Staging browser.
- Enter a value in S&F Max Requests per Second field to limit the number of requests that can be sent per second.
- Click Save, to save all the settings.
- Start the new device you defined in the Workbench.
Defining a trigger to Publish
This section details the step-by-step guide to create the logic and to send the device data to AWS.
To create a trigger, do the following:
- Right-click on Projects and select New.
- Enter the Name and Description.
- Right-click on the new project and click Start.
The project state changes to Started. - Double-click on the project you just started, to open the project on a new tab.
- Click New to start defining a new Trigger.
The Trigger screen appears. The yellow box contains the event types, the blue box contains the actions, and the green box is the canvas.
To define the trigger do the following:- Enter the Name of the trigger.
- Click the Trigger Event Type drop-down and select On-Demand as the event type.
- Expand the AWS IoT Core action group, drag and drop the Topic Publish action onto the canvas.
- Drag and drop the end execution block located above the Trigger actions group.
- Connect the Start to the Topic Publish action block and connect the Topic Publish action block to the End Execution.
- Double-click the Topic Publish action block to edit the action.
- In the Topic Publish window, enter the name of the topic (TestTopic) as defined in the AWS Part 1 - Setting up AWS IoT.
- Enter the Value of the variable as Hello World. In the JSON, change the type of the variable to STRING.
- Right-click on the trigger and click Start.
The trigger starts successfully.
Defining a trigger to Subscribe
This section details the step-by-step guide to create the logic and to subscribe to a topic in the AWS MQTT Client. To create the subscribe trigger, do the following:
- Double-click on the project you created.
- Click New to start defining a new Trigger.
The Trigger screen appears. - To define the trigger do the following:
- Enter the Name of the trigger. For example, Subscribe.
- Click the Trigger Event Type drop-down and select Topic Subscribe as the event type.
- Make sure that the Topic is set to TestTopic. The Publish trigger publishes to the same topic and here you are trying to subscribe to the published message.
- Drag and Drop the end execution block located above the Trigger action group.
- Connect the Start to the End Execution.
- Go to Settings tab and turn-on the reporting, by clicking the Reporting drop-down and selecting On.
- Right-click on the trigger and click Start.
The trigger starts successfully.You cannot fire this trigger because it is just listening to the publishes in AWS MQTT Client.