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!
2
Answers
First you need to create an EFS file system. Then:
Source: https://aws.amazon.com/blogs/compute/using-amazon-efs-for-aws-lambda-in-your-serverless-applications/
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.
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