Start With AWS Mqtt
# Login to console
# IOT
# Create thing
# Generate Certificate
# Create policy
Use iot:* for both sub and publish
# Attach policy with certificate
# Connect using node code
var awsIot = require('aws-iot-device-sdk');
var device = awsIot.device({
keyPath: <YourPrivateKeyPath>,
certPath: <YourCertificatePath>,
caPath: <YourRootCACertificatePath>,
clientId: <YourUniqueClientIdentifier>,
host: <YourCustomEndpoint>
});
device
.on('connect', function() {
console.log('connect');
device.subscribe('topic_1');
device.publish('topic_2', JSON.stringify({ test_data: 1}));
});
device
.on('message', function(topic, payload) {
console.log('message', topic, payload.toString());
});