| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
An AWS Lambda layer to enable Java 21 support.
LayerVersion java21layer = new LayerVersion(this, "Java21Layer", LayerVersionProps.builder()
.layerVersionName("Java21Layer")
.description("Java 21")
.compatibleRuntimes(Arrays.asList(Runtime.PROVIDED_AL2))
.code(Code.fromAsset("java21layer.zip"))
.build());Function exampleWithLayer = new Function(this, "ExampleWithLayer", FunctionProps.builder()
.functionName("example-with-layer")
.description("example-with-layer")
.handler("example.HelloWorld::handleRequest")
.runtime(Runtime.PROVIDED_AL2)
.code(Code.fromAsset("../software/ExampleFunction/target/example.jar"))
.memorySize(512)
.logRetention(RetentionDays.ONE_WEEK)
.layers(singletonList(java21layer))
.build());A custom JRE is created to reduce final file size. Lambda has a 250MB unzipped file size limit.
Dockerfile describes how the JRE is built.
Obviously, it's early days, and this is a preliminary release. There are a couple of known issues:
I'll be working on these as I have time. PRs welcome!
The following JVM settings are added by default.
--add-opens java.base/java.util=ALL-UNNAMED -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xshare:auto
Further suggestions welcomed
aws-lambda-java-core-1.2.3.jar aws-lambda-java-serialization-1.1.2.jar aws-lambda-java-runtime-interface-client-2.4.1.jar $LAMBDA_TASK_ROOT $LAMBDA_TASK_ROOT/* $LAMBDA_TASK_ROOT/lib/*
Much credit to @msailes, who created the original repo from which this project is forked!
| Back | FazBrowse Home | New Git URL |