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.

asked a year ago243 views
1 Answer
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
EXPERT
answered a year ago
  • 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions