The latest version of the aws-sdk has functions for ComprehendMedical, which I'd like to create a lambda function for.
However, the version of the AWS-SDK is a few months outdated, and not able to use these functions yet. Wondering if there is a way to use the latest library?
Thank you!
I recommend you create a Library bundle and create a Lambda Layer with it with the desired version of AWS-SDK in the Library bundle (including any other libraries that you want). Once you have the Lambda layer set you can assign it to your Lambda function(s). This helps with a reduced code size of your Lambda function without having the need to bundle up all the libraries you need with every single Lambda Function. Considering AWS-SDK to be a pretty large library, Lambda Layer will help you manage the size of your individual Lambda functions with purely your code in it.
The steps are simple.
nodejs
, this is going to be your project directory. The name must be nodejs
.npm init
inside of this directory. npm install --save
. Note: local install is important.nodejs
directory and upload it to a Lambda
Layer. Check out my article for the full details on how to set up a Lambda Layer for Node JS dependencies. I reckon that going forward, Lambda Layer should be everyone's choice of dependency management in Lambda.
NOTE: Lambda Layer was introduced recently in AWS re:Invent 2018. It is not only compatible with NodeJS, but also with pretty much any other Language (as per Amazon) like Python, Java, C#, C++ (yes!), Go, Rust etc.