In general, the command ldd and the environment variable LD_LINKER_PATH
is your best friend when running new, untested binaries in Lambda. My process (which I want to get around to automating one day, maybe using Packer), goes like this:
- Run an EC2 instance with the official AWS Lambda AMI.
- Get binary you want to run in AWS Lambda running on the instance (either by installing from a package manager or compiling).
- Run
ldd -v ./the-binary
. Note all of the shared libraries it requires. You’ll need to remember these. - Copy the binary to your local machine. Upload the binary with your AWS Lambda function code that runs the ldd command inside the handler function using the process execution library from your language of choice. In node, this works just fine:
console.log(require('child_process').execSync('ldd -v ./the-binary'))
- Note any shared libraries that are missing in the function output. Copy those over from the EC2 instance to a direct