3

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?

1

3 Answers 3

5

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Yes You can add gcc-c++ as a layer, it will be uncompressed in /opt/

https://github.com/lambci/gcc-lambda-layer

Comments

0

You can use docker images to do this as of 2021 (https://docs.aws.amazon.com/lambda/latest/dg/python-image.html).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.