Search code examples
amazon-web-servicesaws-lambdajava-11corretto

aws lambda fails with jdk 11


I am trying to build an spring boot application with jdk 11 on aws lambda.

I followed tutorial on https://dzone.com/articles/aws-lambda-with-spring-boot and code base of https://github.com/gemerick/spring-boot-lambda/tree/lambda. It worked fine with java 8. Then I changed the Runtime: java8 to java11 in sam.yaml but deploy failed with following reason

        "ResourceStatusReason": "Value java11 at 'runtime' failed to satisfy constraint: 
Member must satisfy enum value set: 
    [java8, nodejs6.10, nodejs8.10, python2.7, python3.6, dotnetcore1.0, dotnetcore2.0, dotnetcore2.1, go1.x] or 
    be a valid ARN (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException;)

As far as I understood aws lambda, does not support jdk 11. Then I read that corretto 11 is out https://aws.amazon.com/about-aws/whats-new/2019/03/amazon-corretto-11-is-now-generally-available/

Does the release of corretto 11 means that aws-lambda support java 11? I could not see any official doc about it. It was my first application with aws lambda. Therefore I am bit confused.

Can anyone please point me about support of jdk 11 with aws lambda


Solution

  • Only Java 8 is currently supported in lambda. See https://docs.aws.amazon.com/lambda/latest/dg/java-programming-model.html

    Edit: you can check out how to use Java 11 as a custom runtime. See https://stackoverflow.com/a/54799017/4814697