0

I am creating a Java repo, that can host multiple Lambda functions serving different needs.

I would like to package them into different jars, one jar per lambda, instead of one single jar for all of them. In this context, I have gone through a few articles:

  1. Is it feasible to create multiple Lambda functions (Java) in a jar
  2. Aws lambda functions multiple jars vs single jar

But I did not understand exactly how can I achieve this.

Could anyone please help here? Thanks.

Joy
  • 4,197
  • 14
  • 61
  • 131
  • 2
    What exactly are you having trouble with? I would make a multi module maven project, with one module for each lambda, and another for common code. – tgdavies Dec 31 '20 at 12:18
  • @tgdavies and to upload different lambdas separately, you would have to build a dedicated module for each lambda? – havryliuk Nov 17 '22 at 13:16

1 Answers1

1

You can create multiple Java projects for each JAR you want to create. Each project will use the Lambda run-time API to create the Lambda function. Then upload each JAR by using the Lambda console. To learn how to create a Java project to build a JAR using Maven, see this AWS tutorial: https://github.com/awsdocs/aws-doc-sdk-examples/tree/master/javav2/usecases/creating_workflows_stepfunctions

The above tutorial shows you how to develop Lambda function by using the Lambda runtime API and an IntelliJ project. Then it shows you how to use Maven to create the JAR. Finally shows you how to deploy the JAR.

smac2020
  • 9,637
  • 4
  • 24
  • 38