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回答
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.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ