Logo

Modernizing codebases with AI

Slide 1

1 / 30

Q CLI Install

Amazon Q Developer CLI is a command-line interface that brings AI-powered assistance directly to your terminal. It helps you write, debug, and optimize code, generate shell commands, and interact with AWS services using natural language.

Amazon Q Developer CLI supports macOS, Linux, and Windows (via WSL). Installation typically involves downloading and running an installer or using package managers like Homebrew on macOS. After installation, you authenticate with your AWS Builder ID to access the full range of features. Create your Builder ID if you don't have one.

macOS / Linux

curl -sSL https://amazon-q-developer-cli.s3.us-west-2.amazonaws.com/install.sh | bash

Windows

Follow this blog post to install Q CLI on Windows using WSL

Verify Installation

q --version
q auth

Key Features and Capabilities:

  • Context-Aware Assistance: Amazon Q CLI understands your project structure, current working directory, and remembers conversation history, providing relevant and contextual help.
  • Code Generation and Assistance: It can generate code snippets, complete/troubleshoot code, and offer inline suggestions similar to IDE autocompletion tools.
  • Natural Language Interaction: You can interact with Amazon Q using natural language prompts to ask questions, generate commands, or receive explanations.
  • AWS Resource Management: It enables you to manage AWS resources directly from the terminal, including executing AWS CLI commands based on natural language input.
  • System Integration: It can execute bash commands, create applications, read/write files, and interact with external systems through its extensible architecture.
  • Persistent Knowledge: Maintains context across sessions through knowledge bases and conversation history.

Core Commands and Usage:

  • q chat: Initiates a conversation with Amazon Q, allowing you to ask questions and receive AI-generated responses.
  • q inline enable/disable/status: Manages inline code suggestions and recommendations within your terminal.
  • /quit: Exits the Amazon Q CLI application.
  • /clear: Resets the current conversation history while maintaining the session.
  • /model: Allows you to view available large language models and switch between them.
  • /tools: Displays the executable functions (MCP tools) that Amazon Q can leverage to perform actions or interact with systems.
  • /save: Save the current conversation for later use.
  • /load: Load a previously saved conversation.
  • /agent: Manage agents for specialized tasks and workflows.
  • /context: Manage context files for the chat session.
  • /editor: Open $EDITOR (defaults to vi) to compose a prompt.
  • /reply: Open $EDITOR with the most recent assistant message quoted for reply.
  • /compact: Summarize the conversation to free up context space.
  • /issue: Create a new Github issue or make a feature request.
  • /changelog: View changelog for Amazon Q CLI.
  • /prompts: View and retrieve prompts.
  • /hooks: View context hooks.
  • /usage: Show current session's context window usage.
  • /mcp: See MCP servers loaded.
  • /experiment: Toggle experimental features.
  • /subscribe: Upgrade to a Q Developer Pro subscription for increased query limits.
  • /todos: View, manage, and resume to-do lists.
  • /help: Print help message or help for specific subcommands.

Kiro Install

Kiro is an AI-powered IDE that integrates seamlessly with Amazon Q Developer and other AI tools through the Model Context Protocol (MCP). It provides intelligent code completion, refactoring suggestions, and enhanced development workflows.

Step 1: Download and Install

Download Kiro IDE and install it on your system.

Step 2: Launch Kiro

Open Kiro IDE from your applications.

Step 3: Login with Builder ID

Use your AWS Builder ID to authenticate with Kiro. Create your Builder ID if you don't have one.

Step 4: Use your access code

Input your access code after browser authentication

Step 5: Verify Account and limits

Click in the Kiro User icon to check your subscription / free tier status

Kiro IDE launch screen

Complete the authentication process and verify your account setup.

Account verification screen

Congratulations! Kiro is now installed and ready to use.


Kiro & MCP

Model Context Protocol (MCP) integration with Kiro IDE allows you to extend functionality with custom tools and resources.

Setting up MCP

Configure MCP servers to provide additional capabilities to your Kiro environment.

MCP Setup 1 MCP Setup 2 MCP Setup 3

AWS Docs MCP Server

Follow the instructions here to add AWS Docs MCP Server config

Whatsapp MCP Server

Follow the instructions here to build a Whatsapp MCP Server

Asana MCP Sample from Al Harris

This repository has a sample JS app with Asana MCP integration

Weather Forecast MCP with Java and Quarkus

Follow this tutorial to create a Java Quarkus MCP Server for weather forecast

Projects

Explore comprehensive Java projects demonstrating modernization techniques, legacy patterns, and AI-powered transformation strategies.

๐Ÿ“ฆ Download All Projects (ZIP)

Spring E-commerce CRUD Application

Location: projects/spring

A Spring Boot-based e-commerce application showcasing legacy Java patterns ready for modernization. Contains deliberate legacy code patterns including old-style switch statements, DTO classes suitable for Record conversion, and Java 8 patterns that can be upgraded to modern Java features.

Architecture:

  • MVC pattern with Spring Boot
  • Repository pattern for data access
  • Service layer with business logic
  • DTO pattern for data transfer

Legacy Patterns for Modernization:

  • DTO classes โ†’ Java Records conversion
  • Old-style switch statements โ†’ Pattern matching
  • Verbose toString() methods โ†’ Record auto-generation
  • Array conversion patterns โ†’ Modern Java 17 syntax

Tech Stack: Spring Boot, JPA/Hibernate, Maven, Java 8+ patterns

Modernization Targets: Java 17 Records, Pattern matching, Stream API enhancements

Domain: Customer, Order, Product management with CRUD operations

Legacy JPA Conference System

Location: projects/jpa

A conference management model built with legacy javax technologies, representing typical enterprise Java applications requiring comprehensive modernization. Demonstrates common legacy patterns found in enterprise systems built with older Java versions.

Legacy Technologies:

  • JPA 1.0 with javax.persistence namespace
  • JavaMail 1.4 for email functionality
  • JUnit 4 for testing framework
  • Java 8 language features

Modernization Roadmap:

  • javax.* โ†’ jakarta.* namespace migration
  • JPA 1.0 โ†’ JPA 3.0+ with modern features
  • JUnit 4 โ†’ JUnit 5 with modern assertions
  • Java 8 โ†’ Java 17/21 with modern language features

Tech Stack: JPA 1.0, JavaMail 1.4, JUnit 4, Maven, Java 8

Domain: Education system with member management and persistence

Complexity: Ideal for demonstrating namespace migration and framework upgrades

Struts2 Legacy Web Application

Location: projects/struts

A template application demonstrating professional CRUD operations using the Struts2 framework. Represents legacy web application patterns commonly found in enterprise environments, showcasing traditional MVC architecture and JSP-based view rendering.

Legacy Web Patterns:

  • Struts2 MVC framework
  • JSP-based view rendering
  • XML-based configuration
  • Traditional servlet-based architecture

Modernization Opportunities:

  • Migration to Spring Boot with Thymeleaf/React
  • RESTful API development
  • Modern security implementations
  • Microservices architecture adoption

Tech Stack: Struts2, JSP, Servlet API, Maven

Use Case: CRUD operations template for enterprise applications

Migration Target: Modern web frameworks (Spring Boot, Quarkus)

Quarkus Financial Entry Management System

Location: projects/quarkus

A production-ready Quarkus-based RESTful application for managing financial entries with DynamoDB integration and AWS Lambda deployment capabilities. Features comprehensive account-based entry management, category filtering, date range querying, and balance calculations.

Architecture:

  • RESTful API with JAX-RS endpoints
  • Service layer with business logic separation
  • DynamoDB integration for NoSQL persistence
  • AWS Lambda serverless deployment
  • Docker containerization support

Tech Stack: Quarkus 3.14.4, Java 17, DynamoDB, AWS Lambda, Maven, Docker

Key Features: Account management, Category-based filtering, Balance calculations, Serverless architecture

Deployment: AWS SAM template included for Lambda deployment

Development: Hot reload with Quarkus dev mode, Local DynamoDB via Docker Compose

Embabel AI Modernization Agent

Location: projects/modernizer

An advanced AI-powered modernization agent built with the Embabel framework for automating Java codebase transformations. Demonstrates intelligent code analysis, pattern recognition, and automated refactoring capabilities using Large Language Models (LLMs).

AI Capabilities:

  • Intelligent code analysis and pattern detection
  • Automated refactoring suggestions
  • Multi-LLM integration with different personas
  • Context-aware code transformations

Framework Features:

  • Spring Shell integration for interactive CLI
  • Dependency injection for AI components
  • Configurable LLM models and hyperparameters
  • Unit testing framework for prompt verification

Tech Stack: Spring Boot, Spring AI, Embabel Framework, Maven, Docker

LLM Support: Amazon Bedrock, OpenAI GPT, Google A2A, and Spring AI compatible models

Use Cases: Code modernization, automated refactoring, intelligent code review

Development: Hot reload, comprehensive testing, CI/CD with GitHub Actions

1. Dependency Documentation with Q CLI

This demo uses Q CLI and JPA sample project to generate basic documentation to the existing Java project highlighting Java 21 upgrade.

Tool used: Amazon Q CLI
Project Used: JPA

2. Multi-project dependency mapping with Q CLI

This demo is similar to the previous one, but instead of analyzing a single Java project, it will analyze all Java projects included in the ๐Ÿ“ฆ sample projects (ZIP).

Tool used: Amazon Q CLI
Project Used: All projects in demo

3. Creating leadership reports

This demo creates a leadership report with business justification to migrate and modernize the project.

Tool used: Amazon Q CLI
Project Used: JPA

4. Q CLI + openrewrite

In many cases you may want to use deterministic solutions to upgrade your Java projects, but even so AI tools can be used to help you deciding recipes or creating custom operations that can be reused without AI to transform a set of similar projects.

Tool used: Amazon Q CLI
Project Used: JPA

5. Kiro - Creating steering documents for Spring project

This demo shows how to create steering documents (md spec files) for your projects to improve the context for further AI prompts.

Tool used: Kiro
Project Used: Spring

6. Kiro - Spec-driven development for Java upgrades

How to use spec-driven development with Kiro to create requirement, design and tasks to upgrade your basecode.

Tool used:Kiro
Project Used:Spring

7. Framework migration: Spring to Quarkus

Using Q CLI to move the old Spring project to Quarkus framework using the existing Quarkus project as reference architecture.

Tool used: Amazon Q CLI
Project Used: Quarkus

8. Framework migration: Quarkus to Spring

Using Q CLI migrate the existing Quarkus project to Spring Boot.

Tool used: Amazon Q CLI
Project Used: Quarkus

1. Install Kiro and Q CLI

  • Install Kiro and Q CLI Following the setup instruction.
  • Create your AWS Builder ID Account. Create your Builder ID if you don't have one.
  • Claim your access code for Kiro

2. Use Q CLI to create reports

Open terminal and move to folder with project JPA, type q [enter] and prompt:

"Create a README.md for this project with dependency map and a list of necessary updates to run java 21"

"Create a technical leadership project justification to upgrade to java 21"

3. Q CLI + OpenRewrite

Open terminal and move to folder with project JPA, type q [enter] and prompt:

create and execute an openrewrite recipe to upgrade this project to java 21. make sure it compiles!

4. Spec driven Modernization with Kiro

Open Kiro and open folder JPA.

Generate steering docs

Open spec-driven chat

"Create a plan to upgrade this project to java 21"

5. Framework migration / Multi-project

Open the sample projects folder in Kiro:

Open spec-driven chat

"Create a migration plan to modernize JPA using the quarkus app as reference architecture

6. Dependency Gov

Open the sample projects folder using Q CLI:

"Create a complete dependency mapping from multiples java projects in this folder. Create allowed, not allowed and allowed with permission dependencies"

7. Framework migration

Now you can play around framework and project migrations:

  • Quarkus to Spring
  • Spring to Quarkus
  • Old JPA project to Quarkus