Greengrass v2 interact with shadows from a nodejs lambda

0

Is there any way to interact with local shadows in ggv2 from a nodejs lambda? I know IPC is not supported in the js sdk, but maybe an mqtt client in a lambda could connect to the mqtt components. Thanks in advance for any ideas other than a python rewrite which I am working on, but, looking for a solution to get ggv2 running with ggv1 lambdas while working on python conversion.

JAG
已提问 2 年前351 查看次数
1 回答
0
已接受的回答

Currently IPC is the only available method for communicating with the local shadow manager. However, the next release of Shadow Manager will support a PubSub API (code) which will enable you to access shadows via MQTT (as long as you configure the appropriate routes in the MQTT Bridge component).

There are downsides to your approach, as you'll need to model your lambda as a client device and give it a private key / cert. But it should serve as a stop gap solution.

AWS
已回答 2 年前
profile picture
专家
已审核 10 个月前
  • Awesome! I tried creating a device and using the certs and the aws-iot-device-sdk-v2 js mqtt client from a lambda but I get an AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE TLS (SSL) Negotiation failed. Is this expected until the updates you mention? I have not been able to get a lambda function as a device to connect to the local MQTT broker. Thanks for all your responses.

  • You won't be able to get this working end-to-end until the next Shadow Manager release. However, you should be able to get the MQTT connection to work.

    We have a detailed tutorial on how to set up client devices here: https://docs.aws.amazon.com/greengrass/v2/developerguide/client-devices-tutorial.html

    TLS failures are usually caused by your client using an incorrect CA, or Greengrass not having sufficient permissions in the certificate policy to verify the client certificate. Both are covered in the above tutorial.

  • You can check greengrass.log for hints. Anything along the lines of "bad_ca" points to an issue with the client. Otherwise it's likely a Greengrass configuration issue and the logs should point you in the right direction.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则