Joy
Joy

Reputation: 4483

Packaging AWS lambda functions into different jars

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.

Upvotes: 0

Views: 722

Answers (1)

smac2020
smac2020

Reputation: 10704

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.

Upvotes: 1

Related Questions