Below is the code snippet. I get ResourceNotFoundException with status code 404. But I have several things registered in the console. Even when i try to create a new thing it gives the same error.
var AWS = require('aws-sdk');
var iot = new AWS.Iot({
endpoint: "https://XXXXXX.iot.us-east-1.amazonaws.com",
region: "us-east-1",
accessKeyId: "XXXXXXXXXXXXXXXX",
secretAccessKey: "XXXXXXXXXXXXXXXX"
});
iot.listThings({}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
As for the credentials, I created a new user in IAM. Set Programmatic access as Access Type and assigned AWSIoTFullAccess permission.
Is there anything wrong here? What is the correct method to do this?
@hashans
Where is the endpoint you're specifying coming from? I don't believe you need to specify an endpoint when using Iot, only IotData.
@chrisradek I got the endpoint from the AWS IOT console in settings screen.
Got it working. Thank you very much. Set the Iot constructor like this.
var iot = new AWS.Iot({
endpoint: "iot.us-east-1.amazonaws.com",
region: "us-east-1",
accessKeyId: "XXXXXXXXXXXXXXXX",
secretAccessKey: "XXXXXXXXXXXXXXXX"
});
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Most helpful comment
@chrisradek I got the endpoint from the AWS IOT console in settings screen.
Got it working. Thank you very much. Set the Iot constructor like this.