aws/elastic-beanstalk-roadmap

Corretto 11 with Tomcat 9 AL2

bhaskar2som1-ops opened this issue ยท 2 comments

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or "me too" comments. They generate extra noise for issue followers and do not help prioritize the request.

Tell us about your request
We would like to have stack build on Elastic beanstalk to support
Corretto 11 with Tomcat 9 AL2

Is this request specific to an Elastic Beanstalk platform?
https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.java
Corretto 11 with Tomcat 9 AL2
Corretto 17 with Tomcat 10 AL2

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
Since amazon is deprecating Corretto 11 with Tomcat 8.5 AL2 we are blocked to migrate to latest stack. since many packages which are supported by AL2 are not being supported by AL 2023

Are you currently working around this issue?
We do not have any work around for the issue which we are facing

Additional context
Anything else we should know?

Attachments
If you think you might have additional information that you'd like to include via an attachment, please do - we'll take a look. (Remember to remove any personally-identifiable information.)

Hello @bhaskar2som1-ops ,

I came across your GitHub issue after recently helping someone with a similar request. I would like to share the .ebextensions configuration file used in my solution. Please note I don't have any insight regarding any updates or ETA's regarding the proposed request. In the meantime, I'm sharing my solution in efforts to raise visibility and assist others who seek to accomplish the same!


Investigation Details:

  1. Created an environment using the latest supported platform on Tomcat [1]:
[Platform Version]: Corretto 8 with Tomcat 9 AL2 version 4.5.1
[Solution Stack Name]:  64bit Amazon Linux 2 v4.5.1 running Tomcat 9 Corretto 8 
  1. Validated the default installed Amazon Corretto packages on yum Package Manager for Amazon Linux.

yum list installed | grep java

java-1.8.0-amazon-corretto.x86_64   1:1.8.0_402.b08-1.amzn2          @amzn2extra-corretto8
java-1.8.0-amazon-corretto-devel.x86_64
java-17-amazon-corretto.x86_64      1:17.0.11+9-1.amzn2.1            @amzn2-core
java-17-amazon-corretto-headless.x86_64
javamail.noarch                     1.4.6-8.amzn2                    @amzn2-core
javapackages-tools.noarch           3.4.1-11.amzn2                   @amzn2-core
  • Per the above output, confirmed only Amazon Corretto 8 & 17 packages are installed by default. Validated Amazon Corretto 8 uses the same install commands found in AWS Documentation [2].
  1. Confirmed Amazon Corretto 8 is running in environment as shown:
    java -version
openjdk version "1.8.0_402"
OpenJDK Runtime Environment Corretto-8.402.08.1 (build 1.8.0_402-b08)
OpenJDK 64-Bit Server VM Corretto-8.402.08.1 (build 25.402-b08, mixed mode)

Solution:

  1. Create an .ebextensions folder at the application bundle root.

[ Example App Structure ]

~/my-app/
|-- META-INF
|-- WEB-INF
|-- index.jsp
|-- .ebextensions/
  1. Create an .ebextensions configuration file (install-corretto11.config) as shown below:
commands:
  command corretto11:
    command: |
      sudo yum install java-11-amazon-corretto -y    
      sudo alternatives --set java /usr/lib/jvm/java-11-amazon-corretto.x86_64/bin/java
  • The solution commands install Amazon Corretto 11 and changes the default java provider per the AWS Documentation [3].
  1. Deploy the Application with.ebextensions configuration file (install-corretto11.config) included.
~/my-app/
|-- META-INF
|-- WEB-INF
|-- index.jsp
|-- .ebextensions/
| โ””โ”€โ”€ install-corretto11.config
  1. The solution can be validated by reviewing log file (/var/log/cfn-init-cmd.log) and/or running the following command on the environment instance:

java -version

openjdk version "11.0.22" 2024-01-16 LTS
OpenJDK Runtime Environment Corretto-11.0.22.7.1 (build 11.0.22+7-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.22.7.1 (build 11.0.22+7-LTS, mixed mode)

I hope the above is helpful! I recommend that you take your time, test your application thoroughly in a development environment, and make any necessary adjustments with the provided solution.


References:
[1] Elastic Beanstalk supported platforms - https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.java
[2] Amazon Corretto 8 Installation Instructions for Amazon Linux 2 and Amazon Linux 2023 - https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/amazon-linux-install.html
[3] Amazon Corretto 11 Installation Instructions for Amazon Linux 2 and Amazon Linux 2023 - https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/amazon-linux-install.html