- Newest
- Most votes
- Most comments
Hi Berssain,
You'll need to change the containerization for your lambda. You want to run it in no container mode. Depending on what system changes you're making you may need the lambda to run as root.
https://docs.aws.amazon.com/greengrass/latest/developerguide/lambda-group-config.html#lambda-containerization-considerations
Thanks,
KR-AWS
I have tested it and I still have one issue.
In one hand I could successfully reboot the device (a RPi) by changing some parameters:
UID and GID = 0
Containerization = No container (always)
But on the other hand, I'm still not being able of executing wget url. What I want to do is to download a file
from a url and to save it on a specific path. I followed this guide https://docs.aws.amazon.com/greengrass/latest/developerguide/lra-console.html
I tried 4 different things:
1- Doing the same as the first case (without container) and without "Resources" configuration.
2- I added a "Resources" configuration, but the deploy failed with the message: "... function: refers to resource of type 'Local.Volume' that is not allowed in IsolationMode = NoContainer)."
3- Then I set the lambda into a Greengrass container without "Resources" configuration.
4- Finally, with the same Greengrass container, I made a configuration in the "Resources" section.
None of the 4 combinations worked.
The thing is that os module worked when I put the lambda out of a container. But I want to access to local resources, and to do this the lambda needs one greengrass container.
What do you think?
** When I say "Resources configuration", I mean to specify a Resource name, Resource type, Source path, Destination path, Group owner file access permission, and Lambda function affiliations.
Edited by: berssain on Oct 29, 2019 5:40 PM
Hi guys, I found one solution.
It's to use requests module instead of os, for downloading files in python3.7.
As I wrote in my last reply, when you configure a lambda to have access to local resources on
the device, it (the lambda) must be embedded into a Greengrass container.
For some actions like rebooting the device, it works setting the lambda out of a container and using
the os module.
But in this case, since I needed special permissions for read/write, it's easier to use the "Resources"
configurations that Greengrass has, and just changing the library/module that you use to do it.
Thanks to KR-AWS for the advice and recommendation. I hadn't taken in consideration the container importance.
I wanted to use os module because it's a little easier. Just by writting: os.system("wget url"),
python emulates a terminal and executes any command. Well, it works fine in a normal desktop, but in
a greengrass container it seems that doesn't work.
Edited by: berssain on Oct 30, 2019 9:50 AM
Relevant content
- Accepted Answerasked 2 years ago
- Accepted Answerasked a year ago
- asked 4 months ago
- asked 3 years ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 3 months ago