Recommended Approach For Querying Combined IoT & Greengrass Data

0

What is the recommended approach for querying data from both AWS IoT & Greengrass V2? I have been attempting to use the SDK to get the data required, but I am forced to use multiple API calls per device to get the required data, which results in Rate Exceeded errors. Is there a way to build a query either with Fleet Hub or Fleet Indexing to get the data below without multiple calls?

thingName, thingId, shadow, thing connectivity, Greengrass core version, Greengrass status, Greengrass installed components

asked 2 years ago253 views
2 Answers
0

As Namratha_K says, the Greengrass information is not yet part of fleet indexing.

If you are doing single Thing deployments, there is an AWS-managed named shadow AWSManagedGreengrassV2Deployment for the Greengrass V2 core device Thing. This shadow contains the core version and the result of the last deployment. You can see this in the console. You should never update or delete this shadow, but you can query it. And since it's a shadow, it can be indexed by fleet indexing and used by Fleet Hub. For example, to find all Greengrass core devices running core version 2.5.3:

shadow.name.AWSManagedGreengrassV2Deployment.reported.ggcVersion: 2.5.3

The core device status is not contained in the AWSManagedGreengrassV2Deployment shadow. And if you have a fleet, you probably want to use Thing group deployments, so this shadow would not be available. Long story short, if you want this information in your fleet index and in Fleet Hub, you are probably best off caching core device status, core device version and installed components in your own consolidated custom shadow.

I'm curious to better understand what APIs you're calling and what is the trigger? At least in the case of GetCoreDevice, ListDeployments, GetDeployment etc they are returning information that rarely changes so they shouldn't really need to be called often. You may consider AWS IoT Events:

https://docs.aws.amazon.com/iot/latest/developerguide/iot-events.html

Greengrass deployments use AWS IoT Jobs so you can use the Jobs events to detect the completion of a deployment and only call the relevant APIs then. Likewise the Lifecycle events can be used for connect/disconnect.

profile pictureAWS
EXPERT
Greg_B
answered 2 years ago
  • Hi Greg, thanks for your reply. I'm currently just calling apis manually to see what data I'm able to pull for reporting purposes. All of our devices are running GGV2, and we are deploying custom components to them via GG as well. In addition we are storing data in the shadow. I'm using the Javascript/Node api, and at the moment the apis I'm calling are:

    client-iot.SearchIndexCommand client-iot.ListThingPrincipalsCommand client-iot.DescribeCertificateCommand client-greengrassv2.GetCoreDeviceCommand client-greengrassv2.ListInstalledComponentsCommand

  • I'm unable to see the AWSManagedGreengrassV2Deployment for any of our devices, and after adding named shadows to the fleet indexing config, I'm unable to query against it either. Is there anything that needs to be done to enable that for us?

  • Have you done a deployment to your core device? I think that shadow won't exist until then. You can find mention of this shadow here: https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-local-shadows.html#ipc-operation-getthingshadow .

    "The AWS IoT Greengrass service uses the AWSManagedGreengrassV2Deployment named shadow to manage deployments that target individual core devices. This named shadow is reserved for use by the AWS IoT Greengrass service. Do not update or delete this named shadow."

  • I should add that the AWSManagedGreengrassV2Deployment shadow is only created if you do a single Thing deployment. If you are doing Thing group deployments, it's not used. I've amended my answer.

0

Hello,

Thank you for reaching out to us.

Currently at this moment, Greengrass data is not available with fleet indexing or fleet hub, you must use the SDK to query this information as you are doing.

Apologies for the impact caused due to this.

AWS
SUPPORT ENGINEER
answered 2 years ago

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