AWS allows to create Lambda function with Java 8
(OpenJDK 8) as runtime.
I need to create a simple function using Open JDK 11
. Something like that:
package example;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
public class Hello {
public String myHandler(int myCount, Context context) {
LambdaLogger logger = context.getLogger();
logger.log("received : " + myCount);
return String.valueOf(myCount);
}
}
There is an option allowing to use a custom runtime and a tutorial that contains an example with Shell. However there is no example with Java
.
Is anyone have already deal with an AWS lambda with custom java runtime?
You can use your existing tools such as Eclipse or IntelliJ IDEA to author Java code and use Maven for packaging your Java code, making it easy to integrate AWS Lambda into your existing development processes. To get started, just upload your code through the AWS Lambda console or CLI and select the Java 11 runtime.
To change the runtime, you create a new container image. When you use a . zip file archive for the deployment package, you choose a runtime when you create the function. To change the runtime, you can update your function's configuration.
You can implement an AWS Lambda runtime in any programming language. A runtime is a program that runs a Lambda function's handler method when the function is invoked. You can include a runtime in your function's deployment package in the form of an executable file named bootstrap .
There's no longer a need to use a custom runtime, as AWS Lambda now supports Java 11.
However, Lambda functions that use this runtime will be run with Amazon Corretto 11 and not OpenJDK 11.
If you wish to run your Lambda function with OpenJDK 11 instead of Corretto 11, then using a custom runtime is still recommended.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With