Community-Managed AWS Lambda Base Images for Java 17

I’m (finally) upgrading several projects to Java 17, the current LTS version. I like to deploy my Lambda functions as container images because it keeps the devops simple — everything is a container! — but there still isn’t an officially-supported base image Java 17, even though it’s been out for almost a year. So I made one and released it to the community. You can find the images on ECR Public Gallery and DockerHub, and the source code is on GitHub. If you’ve been waiting to adopt Java 17 until there was Lambda support, then these base images will let you get started.

Where Can I Find the Base Images?

The images are publicly available on the ECR Public Gallery and DockerHub. I will also make them available on the other major Docker registries, but I’ll make sure that at least the current images stay available on that repository going forward.

How Do I Use Them?

Using these custom base images is just like using stock AWS base images. You can find an example on GitHub at aleph0io/example-java-lambda-function. For convenience, find the Dockerfile below. Note the FROM clause:

FROM public.ecr.aws/aleph0io/lambda/java:17.0.4-al2

COPY target/hello-lambda.jar "${LAMBDA_TASK_ROOT}/lib/"

CMD [ "com.sigpwned.lambda.hello.HelloLambda::handleRequest" ]

How Mature Are They?

The Java 17 images are all tested live on Lambda on deployment. Also, I have built a (very) simple production service using the base image so I know it works, at least after a fashion. Regardless, they are not (well) optimized for size, cold start time, or performance, so please consider them experimental, at least for now. All feedback and PRs welcome!

Can I see the Source Code?

Of course! The source code is released under the Apache 2.0 license. If you’re curious, you can find the source code for the base image on GitHub at aleph0io/aws-lambda-java-base-images.

But I Like To Use Deployment Packages!

Then you need a custom runtime, not a base image! Check out msailes/lambda-java17-layer on GitHub.

Update

Custom base images for Java 18 are now available!

Custom base images for Java 19 are now available, too!