Is there a presence event associated with my Greengrass v2 lambda component?

0

We are in the process of migrating from Greengrass v1 to v2.

With Greengrass v1 we were getting specific presence events when the lambda component was deployed, namely $aws/events/presence/connected/ThingName-c00 and respectively $aws/events/presence/disconnected/ThingName-c00. In addition to those we were getting specific presence events for Greengrass connection, namely $aws/events/presence/connected/ThingName and respectively $aws/events/presence/disconnected/ThingName

We were using these in order to assess that the lambda is deployed or merely Greengrass running.

With Greengrass v2 we are only getting the latter set of presence events.

Is there a similar way to assess that the deployment of the lambda is successful with Greengrass v2?

Our lambda component is configured with a PUB_SUB event source like below:

  "eventSources": [
    {
      "type": "PUB_SUB",
      "topic": "$aws/things/{iot:thingName}/shadow/update/delta"
    }
  ]
demandé il y a 4 mois311 vues
1 réponse
0
Réponse acceptée

Hello,

Lambda in V1 never had any presence events. Both of the events that you're talking about for thingname and thingname-c00 are from Greengrass itself and has nothing to do with your lambda running or not running. Greengrass V1 always had 2 MQTT connections named for the thing name and thing name with c00.

Greengrass V2 has only 1 MQTT connection which is named with the thing name.

If you want to check if your deployment is successful, then simply check the deployment status, not MQTT presence. https://awscli.amazonaws.com/v2/documentation/api/latest/reference/greengrassv2/get-deployment.html

Cheers,

Michael

AWS
EXPERT
répondu il y a 4 mois
profile picture
EXPERT
vérifié il y a un mois
  • I'm sorry I probably didn't explain it right, I did not mean that the lambda is making a connection instead as you say Greengrass v1 is making a second connection when the lambda is running. Greengrass v1 is certainly NOT making the '-c00' connection when the lambda is NOT running and I know that for sure because we've built an entire notification mechanism based on this fact.

    The idea of checking the deployment status is useful to us only if we can create a dynamic thing group to include / exclude devices based on whether the deployment status is success. Do you think that's possible? The reason for using a dynamic thing group is that our device fleet is quite large and instead of querying for the status of each device we would like to always have an up to date list of the devices that have deployed successfully.

  • Yes, I understand what you mean. The c00 connection will be made even if your lambda is not working. That connection is made for the data connection used by any lambdas or shadows that you have configured. It is not specific to a single lambda function and it cannot tell you if a deployment is successful or not. Greengrass V1 offers APIs to get the deployment status which will tell you if a deployment is successful.

    I would not recommend using dynamic groups based on deployment success. Greengrass V2 does let you setup AWS EventBridge rules to be notified when deployments are successful or failed and then execute any logic you may want: https://docs.aws.amazon.com/greengrass/v2/developerguide/deployment-health-notifications.html#deployment.events-message-format.

  • Thank you for suggesting EventBridge, I'll have a go with that.

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions