Reputation: 4010
I've got a C library that does image comparison and Python that calls it. I do not see a C or C++ runtime in the list for AWS-Lambda capabilities. However, isn't Python itself calling C anyway. I thought the interpreter was in fact, C? Can we run C libs called from Python on AWS-Lambda?
Upvotes: 3
Views: 2041
Reputation: 1799
You can use docker images to do this as of 2021 (https://docs.aws.amazon.com/lambda/latest/dg/python-image.html).
Upvotes: 0
Reputation: 101
Yes You can add gcc-c++ as a layer, it will be uncompressed in /opt/
https://github.com/lambci/gcc-lambda-layer
Upvotes: 0
Reputation: 5295
It looks like the answer is yes:
In summary, you can do it by compiling the C libraries statically on the correct machine type, then including them in your Lambda.
Check out this thread on the AWS developer forums:
You will want to compile the C/C++ libraries statically if possible, as it makes including the libraries easier, and on an Amazon Linux Machine. You can find instructions here: https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/ where we build opencv statically compiled and include it in a NodeJS package for usage.
Note that the referenced link is about NodeJS, not Python.
And also:
Per the documentation found here: http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html you will note that it is an x86_64 environment (Linux kernel version – 4.1.19-24.31.amzn1.x86_64), and this page will show you which base AMI's were used for the Lambda Execution Environments.
Upvotes: 5