January 2018
Intermediate to advanced
278 pages
5h 13m
English
After we have configured our AWS IoT and added the IoT device, we can develop a program to access AWS IoT. In this scenario, our computer is used as an IoT thing. We also used Node.js to access AWS IoT, so we need to install AWS IoT SDK for JavaScript. For testing, we will build a Node.js application to access AWS IoT for such purposes as connecting, sending, and receiving.
Now, create a file called comp-demo.js. Then, write the following Node.js scripts:
var awsIot = require('aws-iot-device-sdk');var device = awsIot.device({ keyPath: 'cert/macos-computer.private.key', certPath: 'cert/macos-computer.cert.pem', caPath: 'cert/root-CA.crt', host: 'xxxxxxx.iot.ap-southeast-1.amazonaws.com', clientId: 'user-testing', ...