-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lambda Function to Connect to AWS IoT and Publish MQTT Messages #89
Comments
Hi i just took the reference of internet and wants to send the MQTT message to AWS IOT through a lambda function . Step 1. index.js var awsIot = require('aws-iot-device-sdk'); var device = awsIot.device({ device device Step 2 Step 3: I got the following error But with the same code if i would to send from my local PC to AWS IOT ..it works fine ...can you plz guide me . |
@nbibin001 have you seen: https://github.com/dwyl/aws-lambda-iot-chat ? |
when i do test my lambda function..... what it mean? where do i fix this..?? and how |
Hi I was trying to develop a lambda function which will connect to the AWS thing and publish an MQTT message, I want to receive these published messages on a raspberry Pi which is connected to the thing as well, and subscribed to the same topic. I managed to create the thing, certificate and connect to it. But the lambda function seems to not send the MQTT message. I am attaching my sample code here in the index.js. I kept all my certificates and keys in a folder and zipped and uploaded. Since I am testing this lambda function now, I am not using the event to trigger the connection and message publishing, I just did it like whenever the function is called , it will connect and publish the message. The function seems to be running without error, but I dont see any message coming to my Pi when this runs, (I have a python code running at the Pi side which is subscribed to the same topics, and it is connected to AWS as well).
Below is the lambda code I am using, could anyone please help me if I am missing something here ?
var awsIot = require('aws-iot-device-sdk');
var deviceName = "Bibin_Pi_3"; // Updated by Bibin from AWS IOT Thing name
var thingShadows = awsIot.thingShadow({
keyPath: './private.pem.key',
certPath: './certificate.pem.crt',
caPath: './rootCA.pem',
clientId: deviceName,
region: "eu-east-1",
});
var ctx = null;
exports.handler = function (event, context) {
ctx = context;
};
The text was updated successfully, but these errors were encountered: