I have a Lambda function, which takes very short videos (100-200KB) as input and packages the video using Dash/Hls, and respond to the request with a Manifest file. The media player will then based on the Manifest file to access the video.
For my particular use, the packaged video is only for one time use, after it is accessed, I no longer need to keep it. Therefore, I want to explore the feasibility to put the packaged video in the /tmp folder of the Lambda function instead of S3.
That said, I face the following issues:
So, I am not sure if this is even feasible. If not, is there any other way to make it work? For such small files and one time use, using S3 is kind of waste and also increases delay.
AWS Lambda functions run in containers. The containers are not accessible from outside the Lambda function. It is not possible to send requests to a running Lambda container, so it cannot act as a web server.
Lambda containers can be reused by subsequent executions, which is why you saw previous files in the /tmp/
directory. It is a good idea to delete temporary files before exiting the function to avoid consuming all of the temporary storage.
You might enjoy reading this series of articles about how AWS Lambda operates: Operating Lambda: Performance optimization – Part 1 | AWS Compute Blog