• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

282
Vistas
How to use MQTT-JS or JS AWS-SDK (node JS/JS) to send and receive data to a topic of AWS IoT

I am working on a project, in which I need to connect my devices via MQTT protocol to AWS IoT, to send and receive data.

So first I got my endpoint from the AWS Portal. Please check below screenshot: enter image description here

Then I tried using AWS Lambda for RnD purpose, and it is working as expected. Please check below screenshot, what code I did at AWS Lambda:

enter image description here

But now I want to integrate this at the device end.

I tried MQTT JS to connect devices to AWS IoT data. Please check below code: enter image description here

But this code is not working, no error I got in the output, Its just waiting.

In this code, I used the accessKey and secretKey, which I got after creating a user in AWS-IAM, with permission AWSIoTDataAccess.

I tried AWS-SDK also with the same IAM credentials. Please check below code. enter image description here

But unfortunately, it is also not working.

Note: My device is just a Windows system, which will send and receive data for a topic at AWS IoT.

Please help me to solve this. Don't know what I missed. Any suggestion will be helpful for me. Thanks,

EDIT:

After followed the steps mentioned here https://docs.aws.amazon.com/iot/latest/developerguide/device-certs-create.html, suggested in answer by @sokkasokka. Finally getting some error at least. Please check below screenshot for the edited code and error. enter image description here

almost 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try creating AWS IoT Thing with proper permissions and use the certificates to authenticate your MQTT device.

https://docs.aws.amazon.com/iot/latest/developerguide/device-certs-create.html

And see this issue as well: Fail to connect to AWS IoT via mqtt.js

almost 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda