Automationscribe.com
  • Home
  • AI Scribe
  • AI Tools
  • Artificial Intelligence
  • Contact Us
No Result
View All Result
Automation Scribe
  • Home
  • AI Scribe
  • AI Tools
  • Artificial Intelligence
  • Contact Us
No Result
View All Result
Automationscribe.com
No Result
View All Result

Containerize legacy Spring Boot utility utilizing Amazon Q Developer CLI and MCP server

admin by admin
August 4, 2025
in Artificial Intelligence
0
Containerize legacy Spring Boot utility utilizing Amazon Q Developer CLI and MCP server
399
SHARES
2.3k
VIEWS
Share on FacebookShare on Twitter


Organizations can optimize their migration and modernization tasks by streamlining the containerization course of for legacy functions. With the appropriate instruments and approaches, groups can remodel conventional functions into containerized options effectively, lowering the time spent on guide coding, testing, and debugging whereas enhancing developer productiveness and accelerating time-to-market. Throughout containerization initiatives, organizations can handle compatibility, dependencies, and configurations effectively utilizing automated instruments and finest practices, serving to to maintain tasks on schedule and inside funds parameters. Growth groups can focus extra on innovation by automating routine duties corresponding to utility structure evaluation, deployment script creation, and atmosphere configuration, resulting in smoother transitions throughout totally different phases of the modernization journey.

On this submit, you’ll be taught how one can use Amazon Q Developer command line interface (CLI) with Mannequin Context Protocol (MCP) servers integration to modernize a legacy Java Spring Boot utility operating on premises after which migrate it to Amazon Internet Providers (AWS) by deploying it on Amazon Elastic Kubernetes Service (Amazon EKS). The Amazon Q Developer CLI helps automate frequent duties within the modernization course of. You’ll introduce chaos into the system after profitable modernization. Then you definately’ll troubleshoot it utilizing Amazon Q Developer CLI. You’ll carry out all these actions utilizing pure language prompts with out writing code.

Amazon Q Developer goes past coding to assist builders and IT professionals with lots of their duties—from coding, testing, and deploying to troubleshooting, performing safety scanning and fixes, modernizing functions, optimizing AWS assets, and creating knowledge engineering pipelines. Amazon Q for the command line integrates contextual info, offering Amazon Q with an enhanced understanding of your use case, enabling it to offer related and context-aware responses. The MCP is an open commonplace that permits AI assistants to work together with exterior instruments and providers. It defines a structured method for AI fashions to find obtainable instruments, request instrument execution with particular parameters, and obtain and course of instrument outcomes. You’ll use MCP to increase the capabilities of Amazon Q Developer CLI by connecting it to customized instruments and providers.

Though we’re showcasing the potential of Amazon Q Developer CLI on this finish -to-end migration and modernization journey, in the event you’re utilizing one of many supported built-in growth environments (IDEs) and Java variations, you should utilize the /remodel command to carry out the step 2. For extra info, go to Upgrading Java variations from Amazon Q Developer.

Resolution overview

MCP servers act like a common connector for AI fashions, enabling them to work together with exterior techniques, fetch dwell knowledge, and combine with numerous instruments seamlessly. This permits Amazon Q to offer extra contextually related help by accessing the knowledge it wants in real-time. The next structure diagram reveals how Amazon Q Developer CLI connects to exterior knowledge sources by MCP servers.

Solution overview

The next is a abstract of the performance of the structure:

  • You’ll configure MCP consumer in Amazon Q Developer CLI utilizing mcp.json file.
  • You’ll log in to Amazon Q Developer CLI and ask queries in pure language.
  • Relying in your question, Amazon Q Developer decides which MCP server(s) that you just configured or current instruments to invoke for performing the duty. At current, Amazon Q Developer helps stdio native MCP servers solely.
  • The MCP server interacts with the respective exterior system to get the dwell knowledge that’s utilized by Amazon Q to carry out the required activity.

The answer follows these high-level steps, as proven within the following graphic:

  1. Create legacy Java Spring Boot utility
  2. Improve Java and Spring Boot variations
  3. Containerize the upgraded utility
  4. Deploy the appliance on Amazon EKS
  5. Introduce chaos
  6. Troubleshoot and repair

Modernization journey

Conditions

You could have the next configured earlier than you begin establishing the demo:

Configure MCP in Amazon Q Developer CLI

MCP configuration in Amazon Q Developer CLI is managed by JSON information. You’ll configure Amazon Bedrock EKS MCP Server. On the time of this writing, solely the stdio transport is supported in Amazon Q Developer CLI.

Amazon Q Developer CLI helps two ranges of MCP configuration:

  1. World configuration: ~/.aws/amazonq/mcp.json – Applies to all workspaces
  2. Workspace configuration: .amazonq/mcp.json – Particular to the present workspace

On this demonstration, we’re utilizing workspace configuration, however you should utilize both of them. Observe these steps:

  1. Create a brand new workspace folder and inside that folder create .amazonq/mcp.json file with the next content material:
{
  "mcpServers": {
    "awslabs.eks-mcp-server": {
      "command": "uvx",
      "args": [
        "awslabs.eks-mcp-server",
        "--allow-write",
        "--allow-sensitive-data-access"
      ],
      "env": {
        "AWS_PROFILE": "your-profile-name",
        "AWS_REGION": "your-region",        
        "FASTMCP_LOG_LEVEL": "ERROR"
      },
      "autoApprove": [
        "manage_eks_stacks",
        "manage_k8s_resource",
        "list_k8s_resources",
        "get_pod_logs",
        "get_k8s_events",
        "get_cloudwatch_logs",
        "get_cloudwatch_metrics",
        "get_policies_for_role",
        "search_eks_troubleshoot_guide",
        "list_api_versions"
      ],
      "disabled": false
    }    
  }
}

  1. Open a terminal, navigate to the workspace folder that you just created in step 1, and enter the next command to log into Amazon Q Developer CLI. Observe the instruction on the display to login to Amazon Q Developer on the command line:

q login

  1. Provoke the chat session by coming into q after which /instruments to validate that the Amazon EKS MCP server is configured, as proven within the following screenshot. By default, it gained’t be trusted.

Amazon Q Developer CLI

Migrate and modernize Java Spring Boot utility

Emigrate and modernize a Java Spring Boot utility, full the steps within the following sections.

Create legacy Java Spring Boot utility

To create a legacy Java Spring Boot utility, you first construct a legacy Java 8, Spring Boot 2.3.x bookstore utility, which you’ll modernize and migrate to AWS. Return to Amazon Q Developer CLI and use pure language question to create the previous utility. Observe these steps:

  1. You should utilize your individual phrases or use the next immediate to generate the code. The immediate generates the pattern payloads to check the appliance. Make a copy of these payloads for later use. To grasp extra about finest practices for immediate engineering, consult with Mastering Amazon Q Developer Half 1: Crafting Efficient Prompts within the AWS DevOps & Developer Productiveness Weblog.
You'll bootstrap the present listing with a java 8 spring boot RESTful microservice utility which supplies an API. The microservice supplies operations for storing, updating, deleting and discovering e book info. The supported attributes are isbn, book_title, creator, worth, and forex. The value attribute is numeric and every part else is String. The isbn attribute format must be validated as per commonplace ISBN code format. You should utilize regex for that. Retailer the e book info in native cache. It also needs to present an Actuator endpoint. The undertaking needs to be constructed utilizing Maven. Share instance payloads to check the microservice now. As soon as I evaluate and approve the payload proceed with bootstrapping. 

  1. Present approval to generate the legacy utility.

Amazon Q Developer CLI generates the working code with Java 8 utilizing Spring Boot 2.3.x framework.

  1. Discover the generated undertaking information and validate the Java and Spring Boot variations.
  2. Present the next immediate to run the appliance.
Are you able to run the microservice?

  1. Check the microservice utilizing a REST API consumer or utilizing curl command. You may as well ask Amazon Q Developer CLI to check the appliance and repair errors, making ready a totally practical service!
  2. After testing is full, cease the microservice. Your legacy utility is now able to be modernized.
  3. (Optionally available) Ask Amazon Q Developer CLI to generate a part and sequence diagram for the legacy utility.

Seek advice from the next video for a fast demo.

Improve Java and Spring Boot variations

Improve the legacy Java Spring Boot utility that you just created within the earlier step utilizing Amazon Q Developer CLI.

As talked about beforehand, in the event you’re utilizing one of many supported built-in growth environments (IDEs) and Java variations, you should utilize the /remodel command inside your IDE to carry out this step.

  1. Use your individual phrases or the next immediate to replace the legacy utility. Amazon Q Developer performs required adjustments in each maven pom.xml and Java code to improve to Java 21 and Spring Boot 3.5.0. It builds the code after the improve. If the construct fails, then Amazon Q Developer iteratively tries to repair the construct by making use of vital code and configuration adjustments.
Are you able to replace the microservice from Java 8 to Java 21? Additionally replace the spring-boot model to model 3.5.0?  

  1. After the undertaking improve is full, validate the pom.xml for Java and Spring Boot variations. Discover the adjustments made to the Java code. The next instance code from pom.xml validates the up to date Java and Spring Boot variations:
    
        21
    
…
    
        org.springframework.boot
        spring-boot-starter-parent
        3.5.0
        
    

  1. Present the next immediate to run the appliance:
Are you able to run the microservice?

  1. Retest the microservice and make it possible for it’s nonetheless working as anticipated. You should utilize Amazon Q Developer CLI to check, troubleshoot, and repair the upgraded utility, if wanted.
  2. After testing is full, cease the microservice. Your legacy utility is now upgraded to Java 21 and Spring Boot 3.5.0.

Seek advice from the next video to know extra.

Containerize the upgraded utility

Containerize the appliance in order that the appliance could be run on each x86_64 and ARM64 {hardware}:

  1. Use your individual phrases or the next immediate to create docker picture for the appliance Amazon Q Developer creates the Dockerfile to your utility and builds it to create pictures that may be run on x86_64 and ARM64 techniques.
Are you able to containerize this utility? Create a Dockerfile, construct the container picture and tag with "eks-bookstore-java-microservice"? Run and check the endpoints. Make sure that the container is constructed as a multi-architecture picture supporting each x86_64 and ARM64.  

  1. Discover and validate the Dockerfile created by Amazon Q Developer to your utility.
  2. Present the next immediate to run the appliance in your native system:
Are you able to run the docker picture on my laptop computer?

  1. Check the microservice utilizing a REST API consumer or utilizing curl command. When it’s finished, cease the docker container utilizing the next immediate:

Your utility is now containerized and examined on the native system. The heavy lifting of the making the code and configuration adjustments, updating the dependency, and writing Dockerfile is finished by Amazon Q Developer.

Seek advice from the next video for a demo.

Deploy the appliance on Amazon EKS

Deploy the containerized utility on Amazon EKS. To take action, create a brand new EKS cluster and use Helm Chart to deploy the appliance. Amazon Q Developer CLI makes use of Amazon EKS MCP server to carry out a few of these actions. Amazon Q Developer CLI makes use of the default profile except instructed to make use of one other.

  1. Use your individual phrases or the next immediate to push the docker picture to an Amazon Elastic Container Registry (Amazon ECR) repository:
Construct the Dockerfile and push this picture to an Amazon ECR repository known as "eks-bookstore-java-microservice" within the AWS account. Present the picture URL as soon as that is full.  

  1. Present the next immediate to deploy the picture into a brand new EKS cluster utilizing Helm chart:
Create a brand new Amazon EKS cluster. Deploy the microservice to the EKS cluster utilizing Helm chart. I need to check the microservice over the general public Web. Share the microservice URL to check as soon as finished. 

  1. Enter the next command within the Amazon Q chat session to test the appliance pods are operating. Alternately, ask Amazon Q chat to get the pods utilizing kubectl:
  1. Check the microservice once more to make it possible for the deployed utility is working as anticipated.

Your containerized utility is now operating efficiently on the EKS cluster. This completes the migration and modernization of the legacy Java Spring Boot utility.

Seek advice from the next video for a demo.

Introduce chaos

In real-world advanced functions, whereas Amazon Q Developer performs the heavy lifting of upgrading, containerizing, and deploying the appliance on AWS, you may encounter application-specific environmental points. On this step, you’ll simulate an out-of-memory (OOM) difficulty by introducing chaos into the system. You may introduce the chaos utilizing one of many under choices:

You may introduce the chaos utilizing AWS Fault Injection Service EKS Pod actions or by following the under steps:

  1. Apply a patch deployment to cut back reminiscence allocation:
apiVersion: apps/v1
sort: Deployment
metadata:
  title: bookstore-bookstore
spec:
  template:
    spec:
      containers:
      - title: bookstore
        env:
        - title: JAVA_OPTS
          worth: "-Xms200m -Xmx200m -XX:+CrashOnOutOfMemoryError"
        assets:
          limits:
            reminiscence: "128Mi"
            cpu: "500m"
          requests:
            reminiscence: "64Mi"
            cpu: "100m"

  1. Introduce stress:
apiVersion: batch/v1
sort: Job
metadata:
  title: stress-test
spec:
  template:
    spec:
      containers:
      - title: stress-test
        picture: polinux/stress
        command: ["stress"]
        args: ["--vm", "1", "--vm-bytes", "350M", "--vm-hang", "0"]
        assets:
          limits:
            reminiscence: "400Mi"
            cpu: "500m"
          requests:
            reminiscence: "200Mi"
            cpu: "200m"
        env:
        - title: TARGET_POD
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
      restartPolicy: By no means

Wait till the pods crashes with an OOM error.

Seek advice from the next video for a demo.

Troubleshoot and repair

Troubleshoot the difficulty utilizing Amazon Q Developer CLI with EKS MCP server:

  1. Use your individual phrases or the next immediate to start out troubleshooting the appliance utilizing Amazon Q Developer CLI. It would take a number of iterations to establish the foundation trigger and potential repair.
I've used Helm chart to deploy the appliance on EKS cluster. However utility is just not operating. Are you able to establish the foundation reason for this the difficulty and share the potential repair for the difficulty?

  1. After you validate that Amazon Q Developer CLI can establish the foundation reason for the difficulty and recommend a possible answer, present approval to let it repair the difficulty:
  1. Validate the appliance is operating positive by checking the pod standing and invoking the APIs utilizing curl command or a REST API consumer.

Modifications associated to safety in Amazon EKS are out of scope for this submit. Observe the safety finest practices earlier than shifting into manufacturing. Utilizing Amazon Q Developer, you’ll be able to speed up the migration and modernization journey, however because the proprietor of the code, you might want to do the due diligence on the adjustments.

Because of the inherent nondeterministic nature of the FMs, the responses of the Amazon Q Developer CLI may not be precisely similar as these proven within the demo. You could modify the prompts accordingly.

Seek advice from the next video for a demo.

Clear up

Correctly decommissioning provisioned AWS assets is a vital finest follow to optimize prices and improve safety posture after concluding proofs of idea and demonstrations. Observe the steps to delete the assets created in your AWS account:

  1. Use your individual phrases or the next immediate to establish the assets that have been created throughout this demonstration.
I've examined the appliance. It's time for clean-up. Are you able to listing down the AWS assets that you just created for this microservices? Don't delete something, give me the listing. You'll delete solely after I verify.

  1. Fastidiously validate whether or not Amazon Q Developer has appropriately recognized solely the specified assets to be deleted after which present approval. If unsure, manually delete them.
Okay, please go forward and delete.

  1. Delete the .amazonq/mcp.json file out of your workspace folder to take away MCP configuration for Amazon Q Developer CLI.

Conclusion

On this submit, you realized how Amazon Q Developer CLI with Amazon EKS MCP server integration interprets pure language queries, mechanically converts them into applicable instructions, and identifies the required instruments for execution. You upgraded a legacy Java Spring Boot utility, then containerized it to help deployment on multi-architectural computes. You deployed the appliance on Amazon EKS, launched chaos, and resolved the problems utilizing pure language queries. Utilizing Amazon Q Developer CLI, you’ll be able to enhance your developer’s productiveness many occasions over. We encourage you to discover further use circumstances and share your suggestions with us!

Additional research

For extra info on Amazon Q Developer CLI and AWS MCP servers:


In regards to the authors

Biswanath Mukherjee is a Senior Options Architect at Amazon Internet Providers. He works with massive strategic clients of AWS by offering them technical steerage emigrate and modernize their functions on AWS Cloud. Along with his in depth expertise in cloud structure and migration, he companions with clients to develop modern options that leverage the scalability, reliability, and agility of AWS to fulfill their enterprise wants. His experience spans numerous industries and use circumstances, enabling clients to unlock the complete potential of the AWS Cloud.

Upendra V is a Senior Options Architect at Amazon Internet Providers, specializing in Generative AI and cloud options. He helps enterprise clients design and deploy production-ready Generative AI workloads, implement Massive Language Fashions (LLMs) and Agentic AI techniques, and optimize cloud deployments. With experience in cloud adoption and machine studying, he allows organizations to construct and scale AI-driven functions effectively.

Tags: AmazonApplicationBootCLIContainerizedeveloperlegacyMCPServerSpring
Previous Post

When Fashions Cease Listening: How Characteristic Collapse Quietly Erodes Machine Studying Programs

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Popular News

  • How Aviva constructed a scalable, safe, and dependable MLOps platform utilizing Amazon SageMaker

    How Aviva constructed a scalable, safe, and dependable MLOps platform utilizing Amazon SageMaker

    402 shares
    Share 161 Tweet 101
  • Diffusion Mannequin from Scratch in Pytorch | by Nicholas DiSalvo | Jul, 2024

    401 shares
    Share 160 Tweet 100
  • Unlocking Japanese LLMs with AWS Trainium: Innovators Showcase from the AWS LLM Growth Assist Program

    401 shares
    Share 160 Tweet 100
  • Streamlit fairly styled dataframes half 1: utilizing the pandas Styler

    401 shares
    Share 160 Tweet 100
  • Proton launches ‘Privacy-First’ AI Email Assistant to Compete with Google and Microsoft

    401 shares
    Share 160 Tweet 100

About Us

Automation Scribe is your go-to site for easy-to-understand Artificial Intelligence (AI) articles. Discover insights on AI tools, AI Scribe, and more. Stay updated with the latest advancements in AI technology. Dive into the world of automation with simplified explanations and informative content. Visit us today!

Category

  • AI Scribe
  • AI Tools
  • Artificial Intelligence

Recent Posts

  • Containerize legacy Spring Boot utility utilizing Amazon Q Developer CLI and MCP server
  • When Fashions Cease Listening: How Characteristic Collapse Quietly Erodes Machine Studying Programs
  • Constructing AIOps with Amazon Q Developer CLI and MCP Server
  • Home
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms & Conditions

© 2024 automationscribe.com. All rights reserved.

No Result
View All Result
  • Home
  • AI Scribe
  • AI Tools
  • Artificial Intelligence
  • Contact Us

© 2024 automationscribe.com. All rights reserved.