I'm building a video streaming platform and using AWS MediaConvert to transcode videos uploaded to an S3 bucket. Currently, I have a Lambda function that triggers when a new video is uploaded. The issue is that MediaConvert creates a folder in the output S3 bucket and uploads 5 files there. Is there a way to trigger another Lambda function only after all 5 files are completely uploaded? Any suggestions would be appreciated!
3 Answers
Consider using a Step Function to manage the flow and check for file uploads. When you say all files are uploaded, are you depending on the initial Lambda that responds when the video upload starts? This could streamline your process.
S3 actually doesn't use real folders, just prefixes. If you always expect 5 files, you could split the file names by '/' as a delimiter. Then, your Lambda function can use the `listObjectsV2` call to check for all 5 files before triggering whatever process you need.
You might want to look into the complete event from MediaConvert. This will notify you when the job is done and give you the output files' details, allowing you to trigger your Lambda function for processing them afterward. Alternatively, if you don't have all the file paths ready, you can have the Lambda function exit without processing immediately.
Related Questions
Extract Audio From Video File