简体   繁体   English

有没有办法更改 AWS lambda function 的“暂存”(/tmp) 空间位置?

[英]Is there a way to change the 'scratch' (/tmp) space location of an AWS lambda function?

I'm grabbing some zip files from an S3 bucket and then converting them to gzip.我从 S3 存储桶中抓取一些 zip 文件,然后将它们转换为 gzip。 The zipped files are about 130 megs.压缩文件约为 130 兆。 When uncompressed they are about 2 Gigs so I'm hitting the '[Errno 28] No space left on device' error.未压缩时,它们大约为 2 Gig,所以我遇到了“[Errno 28] 设备上没有剩余空间”错误。

Is it possible to use a different scratch space?是否可以使用不同的暂存空间? maybe an EBS volume?也许是 EBS 卷?

It's not possible. 这是不可能的。 You only have a limited amount of space available to a single invocation of a Lambda function, and you can't add more space. 一次调用Lambda函数只能使用有限的空间,并且不能添加更多空间。 It sounds like AWS Lambda isn't a good fit for your use case. 听起来AWS Lambda不太适合您的用例。

If you're looking for a more flexible serverless processing service, you might look into Iron.io , which actually runs on AWS. 如果您正在寻找更灵活的无服务器处理服务,则可以考虑Iron.io ,它实际上在AWS上运行。

The accepted answer is no longer accurate due to at least two new AWS features added since the posting.由于发布后至少添加了两个新的 AWS 功能,已接受的答案不再准确。 There are many configuration options and costs to consider, but both would work for the OP's needs.有许多配置选项和成本需要考虑,但两者都能满足 OP 的需求。

  1. Lambda functions can now attach an Elastic File System (EFS) volume. Lambda 函数现在可以附加弹性文件系统 (EFS) 卷。 Write to EFS instead of /tmp.写入 EFS 而不是 /tmp。
  2. Lambda functions now let you configure the size of /tmp. Lambda 函数现在可以让您配置 /tmp 的大小。 Simply increase the size to handle your largest expected file.只需增加大小即可处理最大的预期文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM