How to add executable packages in AWS Lambda

不羁的心 提交于 2019-12-12 04:21:43

问题


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


回答1:


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.




回答2:


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']


来源:https://stackoverflow.com/questions/45101513/how-to-add-executable-packages-in-aws-lambda

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!