I originally asked this over at r/java and was told to ask here as well.
I’m trying to build a small Micronaut project as a proof of concept to run native-image on AWS Lambda (I’ve also tried the spring-native project example cloud-function-aws but it wasn’t working either).
I was able to build a native image locally but I ran into errors when I deployed it because Lambda couldn’t run the binary (compile on my OSX) vs Lambda is running something based on Amazon Linux 2.
I’ve been trying to setup a docker file with amazonlinux image to install graalvm + maven to try to build the native image and extract the binary from there but holy moly is it a pain. I don’t think the Oracle graalVM docker images exist anymore (or I can’t find them) and the gcr images don’t seem to have a package manager so I’m struggling to install Maven. All the effort I’m going through for this feels a bit wrong - like I’m missing some key info. How are other people doing it?
Essentially I’m looking for either a docker image or docker file where I can copy my contents into, build, extract the binary and load to Lambda but it’s much easier said than done.
There is something called gramba which makes this possible. I use it for a Java native image Lambda function. Note: I’m not the author of this library.
I tried with quarkus, pretty neat, try out lambda template, notice all the changes and commands that get fired when you run native image build.
Once you understand the flow you can do all the steps w/o quarks.
Huge difference in cold start, small grpc client poc, jvm 2500 ms, graalvm 350ms. Will be taking to prod soon.
Unfortunately I could not win the argument of nodejs with Typescript.
If java can be sacrificed I suggest python.
I work for AWS as a Specialist Solutions Architect. I’ve been learning about GraalVM and how it works with AWS Lambda and making notes on https://www.graalvmonlambda.com/.
I’ve built and published the docker image I use to build native-image.