- Notifications
You must be signed in to change notification settings - Fork2
AWS Lambda Base Images for Java 17+
License
aleph0io/aws-lambda-java-base-images
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This project provides the missingAWS Lambda base image for Java 17, 18, 19, 20, and 21. The base images are publicly availablein the ECR Public Gallery. You should be able to use them directly in your builds. I use these images in production for personal and commercial projects today, but per the license, there is no warranty, and YMMV.
This project uses the following process to create new Lambda base images:
- Define a Java maven POM that includes all theJava Lambda support libraries as provided scope. This roundabout approach is used to coax @dependabot into flagging new versions as they are published.
- Also teach maven to collect these dependencies and build the appropriate docker images using a Dockerfile and the excellentfabric8io/docker-maven-plugin.
- Use GitHub Actions to perform CI/CD and release new images to the ECR Public Gallery.
You can find an example Lambda function using these base images ataleph0io/example-java-lambda-function. It's just like building any container lambda function. For ease of use, find theDockerfile below. Note theFROM image. Java versions 17-20 are also supported.
FROM public.ecr.aws/aleph0io/java/lambda:21-al2COPY target/hello-lambda.jar "${LAMBDA_TASK_ROOT}/lib/"CMD [ "com.sigpwned.lambda.hello.HelloLambda::handleRequest" ]TheLambda RIE is not currently built into these lambda base images, so to test your lambda function implementations locally, you will need touse the standalone RIE server.
- This image is in no way optimized for cold start time, size, etc. PRs welcome!
- Java 17, 18, 19, 20, and 21 are all supported.
- For now, only x86_64 is supported. I hope to publish multiarch builds including arm64 soon.
- Official base images for Java 17 have been released tolambda/java. Java 17 users should strongly consider moving to the officially-supported base images. This project will continue to release updates for Java 17 on an ongoing basis for those who prefer not to move.
- This project will continue to support non-LTS Java versions that will never receive an officially-supported AWS Lambda base image.
You can find writeups of theJava 17,18,19,20, and21 onmy blog.
Many thanks to@rieckpil forhis outstanding writeup of custom Lambda runtimes. That tutorial was the foundation and basis for this build. Cheers!
Also, thank you to@msailes forthe example Java 17 Lambda layer. This prior art was also critically important to understanding how best to integrate a new Java version into Lambda.
Managed by@sigpwned.
About
AWS Lambda Base Images for Java 17+
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.