Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building AWS Lambda jar

What is the standard practice for creating AWS Lambda jar.

Should we bundle the dependencies as jars within the zip file or should the dependencies be unjarred and included as classes.

As far as I know it is the first option that holds true, but this doubt came to mind when I was following the AWS Tutorial of thumbnails and it eventually created a jar that had classes for dependencies (like Jackson) rather than bundling Jackson jar in the artifact.

Is there a sample AWS Lambda zip file that I can download and try (the one that has dependencies bundled as .jar files and not as .class files)

like image 582
Arafat Nalkhande Avatar asked Sep 25 '26 22:09

Arafat Nalkhande


1 Answers

You should include the dependency jars in a lib subdirectory. If you have a class mypackage.LambdaFunctionHandler, the zip file should have this basic structure:

.
|-- mypackage
|   +-- LambdaFunctionHandler.class
+-- lib
    |-- myjar1.jar
    +-- myjar2.jar
like image 85
ataylor Avatar answered Sep 28 '26 19:09

ataylor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!