Using GraalVM to run Java in AWS Lambda



Is there any ability to use GraalVM to run Java in AWS Lambda functions? I read a lot articles about cold starts of Java applications with GraalVM AOT (ahead-of-time) compilation feature and decreasing duration of that and I’d like to try to use it in my AWS Lambda projects.

Answer

With the introduction of Custom AWS Lambda Runtimes at re:Invent 2018, this is now do-able. See further the AWS Lambda Runtime Interface

You can use the bootstrap shell script published at https://docs.aws.amazon.com/lambda/latest/dg/runtimes-walkthrough.html to invoke your GraalVM native image, or you can implement the bootstrap functionality in your native image.

There is also an interesting article in Japanese on an approach which uses Micronaut which Google can translate for you, and corresponding https://github.com/kencharos/try-graal-lambda though imho the case for using Micronaut here is not that compelling.



Source: stackoverflow