Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I store a temp file on AWS Lambda Function?

I am writing a lambda function for file extraction and need to store a file while performing this function so need to store that file in aws lambda function . Is it possible to store store a file on lambda .

like image 757
Rahul Panwar Avatar asked Jun 20 '18 10:06

Rahul Panwar


People also ask

Can I store file in Lambda function?

You can now mount EFS volumes in Lambda functions, which makes it simpler to share data across invocations. The file system grows and shrinks as you add or delete data, so you do not need to manage storage limits. The Lambda service mounts EFS file systems when the execution environment is prepared.

What is ephemeral storage in Lambda?

More ephemeral storage allows you to download larger models from Amazon S3 to /tmp and use these in your processing. To learn more about using Lambda for ML inference, read Building deep learning inference with AWS Lambda and Amazon EFS and Pay as you go machine learning inference with AWS Lambda.

When you should not use AWS Lambda?

Lambda functions that transport data from one service to another without performing any business logic on that data can often be replaced with service integrations. For example, it's usually not necessary to put a Lambda function between API Gateway and DynamoDB to read an item from a table.


1 Answers

Yes, quoting from the AWS Lambda FAQ

Each Lambda function receives 500MB of non-persistent disk space in its own /tmp directory.

https://aws.amazon.com/lambda/faqs/

Note that as the commenters point out, it is only reliably there for a single execution of your function. You don't have control over the execution environment, so subsequent runs may be in different instances of your lambda function.

If you need the data to be more persistent you should use AWS S3.

like image 117
poida Avatar answered Sep 28 '22 18:09

poida