2 Answers
- Newest
- Most votes
- Most comments
0
IPDetector component might be of interest to you: https://docs.aws.amazon.com/greengrass/v2/developerguide/ip-detector-component.html
answered 2 years ago
0
We also had a need to know the external-facing (i.e public) IP address. We achieved it by just publishing it to the device's twin, where it's easily looked up. Here's how we did it:
mosquitto_pub -h $GG_HOST --cert $GG_HOME/thingCert.crt --key $GG_HOME/privKey.key --cafile $GG_HOME/rootCA.pem -t '$aws/things/'$GG_THING'/shadow/update' -m "$jsonString"
The $jsonString needed to look like so:
{"state":{"reported":{"key1":"val1" ... "IP": $IP }}}'
with $IP looked up easily with a call to:
curl -4 ifconfig.co
All bash, and worked for us. Hope this helps.
answered 2 years ago
Relevant content
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Does this component report the external ip address of the edge device to the cloud, or just to the local log ?
All I can see is that it writes the local IP address on the local network, as opposed to the external-facing ip address .
2022-05-25T14:17:20.372Z [INFO] (pool-1-thread-2) com.aws.greengrass.detector.IpDetectorManager: Acquired host IP addresses. {IpAddresses=[/192.168.1.11]}
It reports local connectivity information of Greengrass Core to the cloud, so that client-devices can discover and connect to the core. (For more information: https://github.com/aws-greengrass/aws-greengrass-ip-detector)
There is no AWS provided component that reports external IP address.