This is boilerplate code for a Java lambda function. To deploy this function code, to an actual lambda you must:
- Run
mvn package
. It will build your poject and generate a JAR file in a/target
directory at the root of the package calledlambda-jar-jar-with-dependencies.jar
- In the AWS console, create a Lambda function. Pick
Java 11
as the language and click Create. - Once created, in the Source Code tab, click on upload and upload the JAR generate in the
/target
directory - Once uploaded, click on
Edit
in theRuntime settings
and point the Handler to the correct class/function (Which isfares.lambda.java.HelloWorld::handleRequest
) - Hit Save, and all done! You should be able to execute the code
Note: If you want to do this process through CDK, follow: https://aws.amazon.com/blogs/opensource/packaging-and-deploying-aws-lambda-functions-written-in-java-with-aws-cloud-development-kit/