I'm using aws lambda as a compiler for C Code, I'm sending to it c code, the lambda compiles and runs it using local g and returns the output back.
I recently had too many concurrent requests that the /tmp directory of the lambda instance was too big (>512mb) and I got the following error: No space left on device
I use efs with the lambda, and I want the /tmp directory of the lambda to be in the efs instead in the instance of the lambda.
I'm using lambda with Docker image. How can I change the instance path of the tmp directory of the lambda to a directory in the efs?
Thank You!
CodePudding user response:
First you need to create an EFS file system. Then:
- Navigate to the Lambda console and select your function from the list.
- Scroll down to the File system panel, and choose Add file system.
- In the File system configuration:
- From the EFS file system dropdown, select the required file system. From the Access point dropdown, choose the required EFS access point.
- In the Local mount path, enter the path your Lambda function uses to access this resource. Enter an absolute path.
- Choose Save.
CodePudding user response:
Since you are already using ephemeral storage go 512 mb, just increase the size to your desired size ( ofcourse this will take some hit and trials to determine depending on your workload and number of requests) as there is no dynamic scaling option of ephemeral storage, you need to consider cost too.
You will find settings for ephemeral storage in general configuration ( aws console )
Note :- If you want to use persistence storage and share that storage among all invocations of LAbda then go for EFS, but if speed matters to you it is faster than EFS