GG Core IP Change cuts connexion to Cloud

0

Hi,

I have a Greengrass Core running on an Ubuntu computer connected via LTE to AWS.
I'm sending data to the AWS cloud via a Python script (the basicDiscovery.py example slightly modified) that I run directly from the same machine.
Due to variability in LTE coverage, the machine loses frequently its connexion for few minutes. On reconnection to LTE, the machine sometimes gets a new IP and from that moment no data is send to the cloud until I restart the Greengrass Core.

  • Is this an expected behaviour ? Is there a specific component I could monitor to check what's happening under the hood ?

I found this Thread which talks about this : https://forums.aws.amazon.com/thread.jspa?messageID=848164. It mentions usage of the onOffline callback and the DiscoveryInfoProvider API to detect disconnections from the Python Script to find the new IP of the core. However, in my case this do not seem to be the issue since my script runs directly on the Core machine and the change of IP do not affect communication from the GGAD to the GGC.

I could monitor the IP and automatically restart the Greengrass daemon when I detect a change, but in this case I will lose every cached message.

  • Has anyone faced this kind of issue ?

Thank you for your answers
RI

iriot
asked 4 years ago193 views
5 Answers
0

Hi iriot,

You can check which IP your GGAD uses to connect to Greengrass Core by checking the discovery logs. IP change of Greengrass Core might impact the connection, because GGAD does not have the information that GGC runs on the same host.

I suggest you remove the discovery logic in your GGAD, and instead hardcode the GGC IP to be localhost during connection here https://github.com/aws/aws-iot-device-sdk-python/blob/master/samples/greengrass/basicDiscovery.py#L152

Let me know if this works for you.

Thanks,
Hui

answered 4 years ago
0

Hi Hui,

Thank you very much for your answer.
I removed the discovery logic and hardcoded 127.0.0.1 to be the GGC IP in my Python Script.

However it seems that I keep getting disconnected from Greengrass everytime my public IP is changing, which makes me think that there is another issue between the GGC and the Cloud... but I did not find it yet.

Alternatively, I implemented a simple script that monitors my public IP and restarts the GG daemon when it changes. That prevents permanent disconnections, but I lose as expected the cached messages.

Cheers,
RI

iriot
answered 4 years ago
0

Hi iriot,

The problem you're running into is the certificates used between the GGAD and the GGC will rotate whenever the IP changes. Even if you only connect locally. You can verify that by looking at the logs to see the certificates rotate.

I've added your comments to our feature request list.

Thanks,
KR-AWS

AWS
KR-AWS
answered 4 years ago
0

Hi,

Is there any specific reason you are using a GGAD to communicate with Greengrass on the same machine?
If you are running the script on the same machine as Greengrass, you could implement the functionality in a Lambda function instead of using GGAD. This would be a much simpler solution.

MA

MaxIoT
answered 4 years ago
0

Hi,

Thanks a lot for both these answers.

If I understand correctly, with my current architecture (GGAD + GGC), it is impossible to solve the issue with the current Greengrass version because of this certificate rotation.

We used a GGAD to communicate with the GGC on the same machine mainly for historical reasons : we updated our system from working directly with AWS IoT Core to AWS Greengrass so we modified our pre-existing "data-producer" Python script to connect to Greengrass (using the basicDiscovery example routines) instead of directly connecting to AWS IoT. The idea of using directly a Lambda on the core seems interesting. I'll investigate if that modification is possible with our current architecture and system components / sensors and I'll keep that in mind for future architectures.

RI

iriot
answered 4 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