skip to Main Content

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


  1. First you need to create an EFS file system. Then:

    1. Navigate to the Lambda console and select your function from the list.
    2. Scroll down to the File system panel, and choose Add file system.
    3. 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.

    Source: https://aws.amazon.com/blogs/compute/using-amazon-efs-for-aws-lambda-in-your-serverless-applications/

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search