Permission denied when trying to create a file from a Greengrass v2 lambda component

0

Hello, we've written a NO_CONTAINER Lambda based component for Greengrass v2 in Java.

This component does attempt to persist a file to local storage but fails as it doesn't seem to be allowed to do so.

2024-07-31T16:07:41.380Z [ERROR] (pool-3-thread-22) com.redbite.AccessFacilitator: Caused by: java.io.IOException: Permission denied. {serviceInstance=0, serviceName=com.redbite.AccessFacilitator, currentState=RUNNING} 2024-07-31T16:07:41.382Z [ERROR] (pool-3-thread-22) com.redbite.AccessFacilitator: at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method). {serviceInstance=0, serviceName=com.redbite.AccessFacilitator, currentState=RUNNING} 2024-07-31T16:07:41.384Z [ERROR] (pool-3-thread-22) com.redbite.AccessFacilitator: at java.base/java.io.File.createNewFile(File.java:1043). {serviceInstance=0, serviceName=com.redbite.AccessFacilitator, currentState=RUNNING}

Is it possible to configure it so that it's allowed to write to local storage?

Also I wonder if using a regular Greengrass v2 component instead of a Lambda one would give us more options.

demandé il y a 2 mois211 vues
2 réponses
0

Lambda component by default has a Read-Only permission to the device file system in which the lambda component is running. You need to update this configuration to Read-Write to be able to persist files on your device using a lambda component.

Ref: https://docs.aws.amazon.com/greengrass/v2/developerguide/import-lambda-function-console.html#import-lambda-console-run-isolated

That being said, I would recommend using a Greengrass V2 native instead of a lambda component. They are easier to develop and troubleshoot.

AWS
sidsriv
répondu il y a 2 mois
  • I have checked the documentation but it seems to suggest I can only do that if the lambda runs inside a container. Can I configure to Read-Write with when I run without any isolation?

  • When using a native component can I take advantage of the subscription and message handling that Greengrass can do in case of a lambda component? That is I configure an eventSources in the component recipe then lambda implements com.amazonaws.services.lambda.runtime.RequestHandler and I'm done.

0

You will need to implement your own hook for AWS service related events for a native GGV2 component. But that should straightforward the AWS SDK. Lambda is a GGV1 concept which is not recommended GGV2.

AWS
sidsriv
répondu il y a 2 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions