We had this not-so-unique usecase where in we had a couple of URLs that pointed to mp3 recordings. We wanted to aggregate these into one recording and save them to our S3 bucket from which we could fetch the recording (and use it in our android app).
We had the following ways to do it:
- Download the audios from the URLs, merge them, and upload them to S3.
- Download the audios from the URLs, upload them to S3. Make Lambda join/merge these audios and save the final audio in another S3 bucket.
- (cool way) Lambda downloads the audios, merges them, and saves the final audio to S3.
We, of course, decided to take the cool way because anything else wasn't challenging enough (actually because this was the most efficient way, as it allowed our server to take zero load for this function).
- Set up Lambda from here. Skip blueprint.
- Copy code from
aggregate_audios.py
to the lambda code editor. - Set your role to
S3 execution role
and set up permissions to includeAmazonS3FullAccess
. - Use the code in
invoke_lambda.py
to invoke your lambda function.