Reputation: 459
I am using API gateway to call lambda function that imports a mpeg file (10 mb) from s3 and saves in /tmp folder of lambda and the lambda uploads it to external API (youtube etc) Recently the API gateway call to lambda is failing intermittently with error
[Errno 28] No space left on device
Here is how i am downloading the file
urllib.urlretrieve (s3_mpeg_url, '/tmp/{}'.format(mpeg_filename))
If i create a new version of that same lambda function and assign to alias API gateway pointing to , it starts to work and again at some point it keeps getting the same error
When i test that lambda function from lambda console it always works
Any idea ?
Upvotes: 25
Views: 27882
Reputation: 573
You can increase the storage from 512MB (default) up to 10,240MB.
CLI:
aws lambda update-function-configuration --function-name <function_name> \
--ephemeral-storage '{"Size": 10240}'
Note that you are charged for any additional size you incremented.
See full article here: https://aws.amazon.com/blogs/aws/aws-lambda-now-supports-up-to-10-gb-ephemeral-storage/
Upvotes: 5
Reputation: 9318
Your lambda function has approximately 500MB of disk space available on /tmp
. However, for performance reasons, AWS Lambda might retain and reuse instances of your function on subsequent calls. There are two possible paths you can take here:
mpeg
file after uploading it to the external API), just delete it from the /tmp
folder after the upload.Upvotes: 27