Is it feasible to create multiple Lambda functions (Java) in a jar


I am new to AWS Lambda and I am using AWS Eclipse plugin to develop Lambda functions.

Question: Is it possible to use a single .jar for all different Lambda functions. In this single .jar file can I have classes for different Lambda functions.

Otherwise, should I create separate .jar files for each Lambda function and upload the .jars separately for each Lambda functions.


It’s possible to use one .jar, but it’s not possible for lambdas to share one .jar. You will need to upload the jar file or provide the same lambda with the s3 location, the location can be the same.

Of course lambda is just a bit of code, so if you want one lambda to share one .jar, it can call different functions based on a value inside the event payload.

Below is an example how one jar could be used in multiple lambdas:

Lambda #1 handler:

Lambda #2 handler:

example code:

Below is an example how one lambda can have essentially two different events:

Leave a Reply