Advice for developing locally in python for Greengrass core

0

Getting to know Greengrass. My current development flow is to write the code in a Cloud9 session and copy the code to S3. From there I revise my component to use the latest version file and deploy that to a core device (Raspberry Pi in this case). I really hate this since there is quite a bit of friction or doing to get the code to a test core machine. Takes at least 5 minutes to test the simplest change.

I am looking for advice on writing code and running so I can get immediate feedback. Two things complicate this a bit:

  1. I need to interact with greengrass components in my code.
  2. In the case of the Raspberry PI I need to get inputs from the GPIO.

The second case is simple, I could just use the keyboard to simulate inputs and when I go to do the final development update the code to use GPIO and test by deploying.

I love using GUI development style and really dislike (but sometimes have to) using VIM style development. IDE's have a lot to offer. I am using Windows as my work station.

I started experimenting with Jupyter yesterday but quickly ran into the "I don't know what I am doing" wall. I tried to use code that imports import awsiot.greengrasscoreipc and that module cannot be found. I did make my windows machine a core device but not sure what to do next???

Anybody have any recommendations for a quicker workflow the write, revise, deploy and test?

flycast
asked 2 months ago25 views
2 Answers
0

Hi flycast,

my preferred way to experiment with component development in Greengrass is to use Jupyter Lab running as a component in Greengrass. You can use Jupyter Lab community component as a starting point. Don't forget to set the accessControl configuration according to which Greengrass IPC APIs you want to use.

Once deployed, you need to create an ssh tunnel with the device to forward the remote port on your local machine. Then you can connect to the Jupyter Lab UI on http://localhost:8888 on your workstation.

Once in the Jupyter Lab UI, can interact with the device using Python, but you need first to install the awsiotsdk using !pip install awsiotsdk.

Cheers,

Massimiliano

EXPERT
answered 2 months ago
  • I was interested in trying that out. There is no Jupyter component listed in public components list in deploy. When I looked at deploying Jupyter It didn't make sense to me. I see you are a contributor at github on this. I see the following:

    You need to upload both community.greengrass.jupyterlab and community.greengrass.libffi to your account, but you need to include only community.greengrass.jupyterlab in your deployments.

    Where do I find the files? I don't see them in the project. Where would I upload them to? Can you point me to a tutorial or something?

0

Hi flycast,

you find several examples howto develop components in our AWS IoT Greengrass V2 workshop.

Cheers,
Philipp

answered 2 months 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