简体   繁体   中英

MongoDB field level encryption with Lambda and Atlas how to include mongocryptd

I try to implement MongoDB client field level encryption with an Atlas M10 cluster and AWS lambda. As far as I understand I would need to have the mongocryptd binary in my path which. How can I bundle this binary with lambda?

You can use Lambda Layer in order to package your dependencies. The Lambda Layer can include pure python library and binary dependencies as well.

Here is how I solved it. The MongoDB documentation includes a section on how to install the MongoDB enterprise version an Amazon Linux 2 (which in August 2020 is used for lambda containers): https://docs.mongodb.com/manual/tutorial/install-mongodb-enterprise-on-amazon-tarball/

I chose to go with tarball installation. After downloading and unpacking the archive, I copied the mongocryptd binary into my serverless project and bundled it with the lambda. Inside the lambda handler I appended the path to binary to the current $PATH, so it is executable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM