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.

질문됨 2달 전211회 조회
2개 답변
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
답변함 2달 전
  • 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
답변함 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠