How can i use tmpfs with AWS Lambda?

0

i have a API that is very IO sensitive, that i want to host using AWS Lambda. I can package the data for this app with my container image, but when the lambda is invoked for the first time, i want to copy this data to tmpfs and server my request from there.

I know this makes my cold boot times horrible. But i dont really care about those. I want responsiveness, because the requests always will come in bulk

The usual workflow, if i were to set this up in an EC2 is to mount a local directory as tmpfs. and then copy files there with a userdata script.

Can someone show me how to do that in Lambda.

I cannot for instance mount any tmpfs file system at boot.

已提问 1 年前266 查看次数
1 回答
0

The /tmp directory on each Lambda function is private to that function - so your cold boot code would need to copy the files to that directory on first boot. By default, Lambda supports 512 MB of temporary storage but that can be increased.

If you wanted to store the files externally, consider using EFS with your Lambda function.

profile pictureAWS
专家
已回答 1 年前
  • thanks @Brettski-AWS. I am already doing that, but unfortunately my response time is too slow. As I said, it is very IO intensive and i have a large dataset. I dont mind a very long cold boot, but once it is up it will get a bunch of quick requests in succession. I had good luck with setting it up with an EC2 instance where i copy all the data from disk to a ram drive, but just a large instance up all the time for a bursty workload doesn't make sense. if i can create a ramdrive / tmpfs on Lambda, that would be the best.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则