AWS Logo
Menu

Amazon Q: Legacy Java Migration to AWS Graviton Containers

Learn how Amazon Q Developer helps modernize Java 8 apps to containerized Java 21 applications optimized for AWS Graviton on Amazon EKS.

Published Apr 11, 2025
Many organizations still operate business-critical applications on Java 8, which has reached its end of public updates. These applications often miss out on the performance improvements, security enhancements, and cost optimizations available in newer technologies.
Amazon Q Developer serves as an intelligent assistant throughout this modernization journey. Using the Amazon Q Developer CLI, you can get step-by-step guidance, troubleshooting help, and best practices for each phase of the migration. Our modernization journey involves four key steps:
  1. Upgrading from Java 8 to Java 21 using Amazon Q Transformation CLI
  2. Identifying and resolving source code and library dependencies for Graviton migration using Porting Advisor for Graviton. Fix identified issues with Amazon Q Developer CLI
  3. Containerizing the application using Amazon Q Developer CLI
  4. Deploying on Amazon EKS using cost-effective Graviton processors using Amazon Q Developer CLI

Prerequisites

  • Amazon Q Developer access
  • Git installed
  • Python virtual environment capability
  • Porting Advisor for Graviton installed
  • Amazon Q Developer CLI and Amazon Q Developer Transformation CLI installed
  • Basic understanding of Java build systems

Implementation steps

Step 1 : Initiate Q CLI chat and clone the repository from github
First, I prompted Amazon Q CLI chat to clone the sample repository.
Step 2 : Planning the Modernization with Q Developer CLI
Then I ask Amazon Q CLI to lay out the steps needed to modernize this application.
> This is a legacy application in Java 8. I need to upgrade the Java 8 to Java 21 and then to containerize on Amazon EKS and run on Graviton powered instances. Analyze this code base for Native code and dependencies. Use Amazon Q Code transformation and AWS graviton porting advisor as well in the steps. Ensure all dependencies are compatible with ARM64 architecture. Minimize the use of exceptions, especially in hot code paths, as they can be more costly on Graviton platforms. Employ Java's Optional class to handle potential null values, reducing the need for NullPointerException. Create a high level plan to achieve this goal. Ask me any clarifying questions before proceeding.
Amazon Q asked me follow up questions and I answered them
Based on the responses, Q refined the migration plan addressing and identifying any specific concerns for Java 21 and Graviton compatibility.
Amazon Q provided detailed steps on how to perform the modernization with right tools and services. I also ask Q to save this plan for future steps.
> Save this plan to plan.md
Step 3 : Use Q Transformation CLI to transform this project to Java 21
I exit the Q CLI chat session and run the Q Transformation CLI as described in this blog
> python -m venv qct-cli
> source qct-cli/bin/activate
> which qct
> qct configure and follow the prompts
> qct transform --source_folder /home/******/qctcli/UnicornDemo --target_version 21
Amazon Q Transformation agent will start the upgrade process and create a new local branch with the changes.
Step 3 : Use Amazon Q CLI to install and invoke Graviton Porting advisor to check for any compatibility issues in porting
> Can you run Porting advisor for Graviton on UnicornDemo project
If Porting Advisor is not installed, Q CLI will install that as well before running.
If there are critical findings, you can ask Amazon Q CLI to fix it as well for you. Since there are no critical findings in this project, I will skip this step.
Step 4 : Use Amazon Q CLI to Containerize the application
> Containerize the application so that it can be deployed in Amazon EKS with Graviton instances
Amazon Q will create necessary files to make this project a container based application including Docker file and Kubernetes configuration files.
Amazon Q has containerized the application and provides the summary of changes.
Step 5 : Use Amazon Q CLI to deploy the application to AWS
> Please deploy this application to my AWS environment
Amazon Q has successfully deployed the application to EKS using Graviton instances. It encountered a few errors while deploying but corrected them and re-deployed successfully.

Benefits of This Modernization Approach

By leveraging Amazon Q to orchestrate this modernization journey, organizations can achieve:
  • Reduced Migration Time: Automated code transformation and guided steps significantly accelerate the modernization process
  • Lower Risk: Systematic approach with testing at each phase minimizes disruption
  • Cost Optimization: Graviton instances offer up to 40% better price/performance compared to x86
  • Performance Improvements: Java 21 and containerization bring significant performance enhancements
  • Future-Readiness: Modern infrastructure enables easier adoption of new technologies

Conclusion

Modernizing legacy Java applications doesn't have to be a daunting task. With Amazon Q orchestrating the journey, organizations can systematically transform their Java 8 applications into modern, containerized Java 21 applications running efficiently on AWS Graviton-powered Amazon EKS.
The agentic capabilities of Amazon Q CLI make it possible to get contextual guidance at each step, automate complex transformations, and follow best practices throughout the modernization process. This not only accelerates the journey but also ensures that the resulting application is optimized for performance, cost, and maintainability in the cloud-native era.
By embracing this approach, organizations can breathe new life into their legacy applications and position themselves for continued innovation in the rapidly evolving technology landscape.
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments