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"
    }
  ]
asked 4 months ago300 views
1 Answer
0
Accepted Answer

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
answered 4 months ago
profile picture
EXPERT
reviewed a month ago
  • 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions