thewebjackal
thewebjackal

Reputation: 869

Is it ok if I don't delete files downloaded to /tmp directory of Lambda functions

For my Lambda function that processes images using ImageMagick (Lambda Layer), I download the input image from S3 to the /tmp directory of my function, process it and upload the output image back to S3 bucket.

In the end, I make sure that I delete the input image downloaded in the /tmp directory. But what I am observing is, it takes time to do that and that time is in seconds.

So, I just wanted to know if I can skip the deleting part of the image. Will /tmp directory be automatically cleaned eventually for me? Do I have to worry about running out of space in the /tmp directory?

Upvotes: 2

Views: 1254

Answers (1)

raupach
raupach

Reputation: 3102

There are quotas for every Lambda function. The /tmp directory of your execution context is limited to 512 MB.

It is totally fine to not cleanup your files, but if the execution context is reused - that happens if your lambda is invoked within the next 10 minutes - the files are still there. So yes, you can run out of space.

Upvotes: 4

Related Questions