[英]How to change the /tmp folder in AWS Lambda to efs
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'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我最近有太多并发请求,lambda 实例的 /tmp 目录太大(>512mb),我收到以下错误:设备上没有剩余空间
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.我将 efs 与 lambda 一起使用,并且我希望 lambda 的 /tmp 目录位于 efs 中,而不是 lambda 的实例中。
I'm using lambda with Docker image.我正在使用 lambda 和 Docker 图像。 How can I change the instance path of the tmp directory of the lambda to a directory in the efs?
如何将lambda的tmp目录的实例路径更改为efs中的目录?
Thank You!谢谢你!
First you need to create an EFS file system.首先,您需要创建一个 EFS 文件系统。 Then:
然后:
Source: https://aws.amazon.com/blogs/compute/using-amazon-efs-for-aws-lambda-in-your-serverless-applications/资料来源: 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.由于您已经在使用临时存储 go 512 mb,因此只需将大小增加到您想要的大小(当然,这需要根据您的工作负载和请求数量来确定),因为临时存储没有动态扩展选项, + 你也需要考虑成本。
You will find settings for ephemeral storage in general configuration ( aws console )
您将在常规配置(aws 控制台)中找到临时存储的设置
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注意:- 如果您想使用持久性存储并在所有 LAbda 调用中共享该存储,则 EFS 为 go,但如果速度对您很重要,它比 EFS 快
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.