Last active
September 7, 2017 16:29
-
-
Save ShakataGaNai/ca5b9791a5797b29de6af43c504085cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AWS = require('aws-sdk'); | |
exports.handler = (event, context, callback) => { | |
var iotdata = new AWS.IotData({endpoint: 'ASDFASDF.iot.us-west-2.amazonaws.com'}); | |
var params = { | |
topic: 'esp8266_RANDOMID/hellofromamzn', | |
payload: 'This is from Lambda', | |
qos: 0 | |
}; | |
iotdata.publish(params, function(err, data) { | |
if (err) console.log(err, err.stack); // an error occurred | |
else{ | |
console.log("message sent"); // successful response | |
context.succeed(); // Echo back the first key value | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment