How to retreive GreengrassV2 Core Device's AWS IoT Thing name

0

When working with already-configured GreengrassV2 core devices (and therefore the associated AWS IoT Thing), how should one go about the local identification of a physical device that's been registered? The Greengrass CLI (https://docs.aws.amazon.com/greengrass/v2/developerguide/gg-cli-reference.html) has no method to describe how the local device is registered to the cloud, and the AWS CLI greengrassv2 command does not help identify "which physical device corresponds to the registered core-device".

Consider a scenario where someone has 5 unmarked Raspberry Pi's set up as core devices. Each is registered as a Greengrass core device / IoT Thing. How can one best cross-reference which Raspberry Pi corresponds to which core device definition?

I see in a recent documentation update, that in a component lifecycle script, a number of environment variables are automatically set including AWS_IOT_THING_NAME. However, these don't seem to be available outisde of a lifecycle script. Is there a configuration file that stores that information which could easily be accessed, outside of the context of a lifecycle script? Is there a local utility installed that can print out this information?

I feel like there must be some simple way to SSH into a physical device and quickly identify which IoT Thing it is. Or am I wrong?

asked 3 years ago874 views
2 Answers
0
Accepted Answer

Hi,
The correct and the recommended way of knowing the thing name within the Greengrass scope is by using the AWS_IOT_THING_NAME environment variable. However, as you mentioned it already - you can read the effective config file at <greengrass-root>/config/effectiveConfig.yaml to know the thingName under system property outside of Greengrass.

Thanks,
Saranya

AWS
Saranya
answered 3 years ago
0

As a follow-up, I now see that there is an "effective config" file in the Greengrass root directory (/greengrass/v2/config/effectiveConfig.yaml on my system after following the current quick-start installation instructions).

In that YAML file, there is a section system.thingName which shows the currently registered name.

Is this the appropriate place to find this information?

answered 3 years ago
  • Just wondering if you explored this idea of reading the config file?

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