Kushal
Kushal

Reputation: 113

How to add executable packages in AWS Lambda

Is there any way to add executable packages like gcc, g++ or jdk on aws lambda and then execute our lambda function.

Upvotes: 0

Views: 3827

Answers (3)

mowwwalker
mowwwalker

Reputation: 17334

If you add a layer, the files are available at /opt as mentioned here: https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html

Upvotes: 0

j08lue
j08lue

Reputation: 1706

From https://aws.amazon.com/blogs/compute/running-executables-in-aws-lambda/:

Including your own executables is easy; just package them in the ZIP file you upload, and then reference them (including the relative path within the ZIP file you created) when you call them from Node.js or from other processes that you’ve previously started. Ensure that you include the following at the start of your function code:

process.env['PATH'] = process.env['PATH'] + ':' + process.env['LAMBDA_TASK_ROOT']

Upvotes: 1

Lucio Veloso
Lucio Veloso

Reputation: 990

Everything that you include in your lambda zip file is deployed in /var/task in the lambda execution.

By this way, you can add your binary in the zip and retrieve it in your code invoking the path /var/task/.

Remember that your binary should be compiled with static option, to avoid errors due dependencies.

Upvotes: 2

Related Questions