Using aws encryption SDK in python AWS lambda


I tried using the aws encryption lib to encrypt/decrypt data with a KMS key in an AWS Lambda ( using python ). However, I get errors when running the lambda ( complaining about shared libs not found, I will update later with exact lib ). I am guessing that the SDK is using shared libs that are not installed in the AWS lambda environment.

This is the SDK I am using:

When building my package I am doing pip install aws-encryption-sdk and cryptography.

Anyone who can give me pointers how to fix it?


Here is the error message:

Unable to import module 'lambdaMain': cannot open shared object file: No such file or directory

Update 2:
For those wondering about the solution. I built the library on the wrong platform. It’s really important to do the pip install etc on an amazon AMI that’s compatible with whatever lambda runtime you are using.


The aws-encryption-sdk requires cryptography library:

The SDK requires the cryptography library on all platforms. All
versions of pip install and build the cryptography library on Windows.
pip 8.1 and later installs and builds cryptography on Linux. If you
are using an earlier version of pip and your Linux environment doesn’t
have the tools needed to build the cryptography library, you need to
install them. For more information, see Building cryptography on

It seems the Lambda environment does not have the required libraries, so you need to add them.

Unfortunately Miserlou’s lambda-packages does not have it, so you need to compile yourself.

Couple pointers:

Leave a Reply