So remember that post I wrote a bit back about the Transcoder? Yeah, that’s old hat now. I wrote a new one. In an afternoon. On a Sunday.
No joke, and it was super, super easy.
I’ve been experimenting with Golang a lot lately (and it is absolutely beautiful, I gotta point that out). I started off yesterday reading about the newest option in AWS Lambda – layers.
For those who aren’t familiar, layers are a way to include necessary files in Lambda functions. At its core, layers are uploaded as zip files, with the zip file essentially being mounted to /opt on the instance. By including other binaries in the layer, you have a clean, simple way to put statically-linked (this part is important!) binaries into your Lambda instances.
In this case, I made a zip file containing a directory, “ffmpeg”, which contains a statically-linked build of ffmpeg. Since the zip file gets mounted to /opt, this means I can call ffmpeg at /opt/ffmpeg/ffmpeg, and pass in its options like I normally would.
From there, it’s just a matter of building the glue to do all of this. What started out as an experiment in Go is now chugging away in production. Who knows what’s next for a cruddy afternoon?