Microsoft Workloads on AWS

Analyze modernization incompatibilities using AWS Migration Hub Strategy Recommendations

In this blog post, we are going to explore in depth how AWS Migration Hub Strategy Recommendations analyzes your environment, what aspects it analyzes, and how to get the most out of the resulting anti-pattern reports.

Introduction

Strategy Recommendations analyzes, based upon your business objectives, server inventory, runtime environments, running applications, and databases to identify viable migration and modernization pathways for your applications. This analysis also provides the anti-pattern reports, which identify discovered incompatibilities you need to address for successful migration or modernization of your applications.

This blog post assumes that you know how to set up and use the Strategy Recommendations service. If you have not used Strategy Recommendations before, we recommend you read the getting started user guide and New Strategy Recommendations Service Helps Streamline AWS Cloud Migration and Modernization blog post. Before you identify modernization pathways and incompatibilities using Strategy Recommendations, you will be required to:

  • Configure data sources – servers hosting the applications you want analyzed.
  • Configure agentless collector.
  • Setup permissions to allow access to the servers from the collector.
  • Prioritize your business goals.

How Strategy Recommendations identifies incompatibilities

Incompatibilities identified by the Strategy Recommendations are things that may prevent the application’s migration/modernization to the cloud. For example, a .NET Framework ASP.NET MVC web application running on an Amazon Elastic Compute Cloud (Amazon EC2) instance that depends on the local file system to read application or configurations.

Once Strategy Recommendations identifies the inventory of servers in your environment, it follows a three-stage process to analyze them:

  • Runtime analysis.
  • Application analysis.
  • Database analysis.

The following diagram, presented in Figure 1, shows in more detail the steps Strategy Recommendations takes while going through this process:

Strategy Recommendations analysis flow

Figure 1: Strategy Recommendations analysis flow

Strategy Recommendations runs multiple analysis on the servers you configured and on the applications it identifies. Some of these analyzers are exclusive to Strategy Recommendations, while others rely on the capabilities of some existing AWS migration and modernization tools, such as AWS App2Container (AWS A2C), AWS End-of-Support Migration Program (AWS EMP), Porting Assistant for .NET, and AWS Schema Conversion Tool (AWS SCT).

In the following sections, we are going to explore what is involved in each stage and what type of recommendations or incompatibilities are expected from them.

Runtime analysis stage

Runtime analysis focuses on gathering information at a server level. This information will be used, alongside application analysis results, to provide the migration and modernization recommendations when you run Strategy Recommendations data analysis.

When you kick off the data analysis from the service console, the service will create and schedule tasks for the Strategy Recommendations collector. The collector polls for tasks and runs the analyzers on the servers configured for analysis. Apart from the Strategy Recommendations analyzers, this phase also uses the capabilities provided by AWS EMP and AWS A2C to collect the data required to run its recommendations engine.

  • Some examples of the data collected by the Strategy Recommendations include Operating System (OS), OS version, running processes, and application components like .NET/IIS, Java, and SQL Server applications. This data is fed into the recommendations engine, which will then provide you with recommendations for a migration and modernization strategy.
  • The AWS EMP analyzer looks at .NET Framework applications running on an out-of-support Windows Server OS and suggest using EMP to move it to a currently supported one.
  • The AWS A2C analyzer looks for IIS applications that can be containerized. When the recommendations engine combines this data with the business priorities, it may suggest using the AWS App2Container tool to move the application to containers and host it on AWS.

This stage will produce a set of application components, recommendations, and identify potential incompatibilities by running all the above analyzers at the server level. These recommendations don’t factor in any source code or database analysis. But once the runtime analysis completes, you will have an option to manually trigger further source code and database analysis against identified application components and refresh the recommendations based on the new data.

Application analysis stage

When Strategy Recommendations identifies .NET Framework/IIS or Java applications on any of the servers, it further performs a binary analysis to detect modernization incompatibilities by inspecting the binaries.

For .NET Framework/IIS applications running on Windows, the service will report incompatibilities to port the code to .NET (Core). This analysis is provided by the capabilities of the Porting Assistant for .NET tool. The results are the same as when you run the Porting Assistant tool against your code.

For Java web applications running on Tomcat or JBoss and hosted on Linux servers, the service detects incompatibilities in the code that have to be fixed for making this application built for the cloud.

For both of the previous analyses, the service will also report general incompatibilities that make it difficult to host an application in the cloud. Some examples of this are: accessing the local file system, having static IP addresses, using the Windows registry, using Remote Procedure Calls (RPCs), among others.

Strategy Recommendations runs binary analysis every time you kick off a data analysis from the console. If you want to make a more in-depth analysis of your applications, you can provide Strategy Recommendations access to your source code. Currently, Strategy Recommendations can perform source code analysis for Java and C# programming languages stored on GitHub, GitHub Enterprise, or Azure DevOps Git Repos. By providing access to your source code, Strategy Recommendations can generate incompatibilities that can’t be identified from looking at the binaries alone.

To get started with source code analysis, configure source code analysis on each application component you are interested. Valid application components display a component type of Java, .NET Framework, or IIS. The user guide has step-by-step instructions to configure your application components for source code analysis.

Database analysis stage

You can perform database analysis on application components identified as database servers by the Strategy Recommendations runtime analysis. For example, a SQL Server database in your application portfolio will be identified as an application component with a component type of SQLSERVER.EXE in Strategy Recommendations. Currently, only SQL Server is supported for database analysis.

Database analysis is a two-step process:

Strategy Recommendations uses AWS SCT for the database analysis. AWS SCT helps you convert your existing database schema from one database engine to another. So the recommendations and incompatibilities you will get out of Strategy Recommendations will be the same ones you will find when creating a migration assessment reports with AWS SCT.

Exploring the anti-pattern reports

When Strategy Recommendations finishes analyzing your servers and applications, it is time to explore the incompatibilities it found. At the bottom of the recommendations dashboard, as well as each application component detail page, there will be a box with the count of incompatibilities grouped by severity, and a link to download the report JSON file from an Amazon Simple Storage Service (Amazon S3) bucket as shown in Figure 2:

Anti-patterns UI on AWS console

Figure 2: Anti-patterns UI on AWS console

Once you have downloaded the anti-pattern reports, you can run your own tools or scripts to analyze the results. For example, the following is a Python script generating a Microsoft Excel spreadsheet with one worksheet for each analyzed strategy:

import argparse
import json
import openpyxl

# Parse command line arguments
parser = argparse.ArgumentParser()
parser.add_argument('file_path', help='Path to Strategy Recommendations\' anti-patterns analysis report JSON file')
args = parser.parse_args()

# Load JSON content from file
try:
    with open(args.file_path, 'r') as f:
        data = json.load(f)
except FileNotFoundError:
    print(f"File not found: {args.file_path}")
    exit()
except json.JSONDecodeError:
    print(f"Invalid JSON file: {args.file_path}")
    exit()

# Create new workbook
workbook = openpyxl.Workbook()

# Create summary worksheet
summary_worksheet = workbook.active
summary_worksheet.title = 'Summary'
summary_worksheet.append(['Strategy', 'Destination', 'Tool', 'Anti-Pattern', 'Severity', 'Occurrences', 'Advice'])

# Iterate over strategyOptions
for strategy_option in data['reportDetails']['strategyOptions']:
    # Create new worksheet for strategy
    worksheet_name = f"{strategy_option['strategy']}_{strategy_option['destination']}"
    strategy_worksheet = workbook.create_sheet(title=worksheet_name)

    # Create table headers for strategy worksheet
    strategy_worksheet.append(['Anti-pattern', 'Severity', 'Resource Name', 'Component', 'Recommendation', 'Location'])

    # Check if there are any antipattern details for this strategy option
    if 'antipatternDetails' in strategy_option and len(strategy_option['antipatternDetails']) > 0:
        # Iterate over antipatternDetails
        for antipattern_detail in strategy_option['antipatternDetails']:
            # Add row to summary worksheet
            summary_worksheet.append([
                strategy_option['strategy'],
                strategy_option['destination'],
                strategy_option['tool'],
                antipattern_detail['antipatternName'],
                antipattern_detail['severity'],
                len(antipattern_detail['codeLocations']),
                antipattern_detail['advice']
            ])

            # Add rows to strategy worksheet
            for code_location in antipattern_detail['codeLocations']:
                strategy_worksheet.append([
                    antipattern_detail['antipatternName'],
                    antipattern_detail['severity'],
                    code_location['resourceName'],
                    code_location['antipatternDescriptor'],
                    code_location['recommendation'],
                    json.dumps({
                        'startLinePosition': code_location['startLinePosition'],
                        'endLinePosition': code_location['endLinePosition'],
                        'startCharPosition': code_location['startCharPosition'],
                        'endCharPosition': code_location['endCharPosition']
                    })
                ])

            # Set column widths to fit content
            for column_cells in strategy_worksheet.columns:
                length = max(len(str(cell.value)) for cell in column_cells)
                strategy_worksheet.column_dimensions[column_cells[0].column_letter].width = min(length, 255)
    else:
        # Add empty row to summary worksheet
        summary_worksheet.append([
            strategy_option['strategy'],
            strategy_option['destination'],
            strategy_option['tool'],
            'N/A',
            'N/A',
            0
        ])

    # Set column widths to fit content for summary worksheet
    for column_cells in summary_worksheet.columns:
        length = max(len(str(cell.value)) for cell in column_cells)
        summary_worksheet.column_dimensions[column_cells[0].column_letter].width = min(length, 255)
            
# Save workbook to file
output_file_path = f"{args.file_path}.xlsx"
workbook.save(output_file_path)
print(f"Excel file saved to {output_file_path}")

To use this script, save it on your local machine and run it from the command line, providing the path to the JSON file as an argument:

python sr_antipatterns.py [path/to/input.json]

Make sure you have the openpyxl library installed using pip install openpyxl before running the script. The script will create an Excel file with the same name as the JSON file but with the extension .xlsx. You can do additional analysis or plot into a chart the contents of the resulting Excel file, as shown in the Figure 3:

Anti-pattern report spreadsheet

Figure 3: Anti-pattern report spreadsheet

Conclusion

In this blog post, we explored how Strategy Recommendations provides an integrated environment that automates the execution of different type of analyzers, centralizing their results in a single pane of glass to help you get a better understanding of the effort needed for your migration or modernization journey. We also explored the different stages in which Strategy Recommendations analyzes your environment, the incompatibilities you can expect from each stage, and how you can visualize the resulting JSON reports.

Thanks to the recently launched binary analysis capability of Strategy Recommendations, you don’t need to provide access to your source code to get incompatibilities reports for your web applications. You can take advantage of these capabilities and get started analyzing your servers and application portfolios with AWS Migration Hub Strategy Recommendations today.


AWS can help you assess how your company can get the most out of cloud. Join the millions of AWS customers that trust us to migrate and modernize their most important applications in the cloud. To learn more about modernizing Windows Server or SQL Server, visit Modernize Windows Workloads with AWS. Contact us to start your modernization journey today.

Cristobal Espinosa

Cristobal Espinosa

Cristobal is a Sr. Solutions Architect at Amazon Web Services. He specializes in helping customers modernize their .NET applications running on AWS. Since 2009, he has helped organizations modernize their legacy .NET applications using open web technologies, Kubernetes, CI/CD and cloud-native services.

Jagadeesh Chitikesi

Jagadeesh Chitikesi

Jagadeesh is a Sr. Microsoft Specialist Solutions Architect at AWS. He worked as a developer and an architect with enterprises of all sizes across healthcare, finance, retail, utility, and government for the last 20 years. He is passionate about cloud and all the innovation happening at AWS.

Uday Kiran Erukulla

Uday Kiran Erukulla

Uday Kiran Erukulla is a Software Development Engineering lead with AWS Migration Hub Strategy Recommendations Service. This service helps customers modernize their workloads by suggesting recommendations and viable options on how to migrate workloads to AWS or modernize already existing workloads on AWS.

Yan Zeng

Yan Zeng

Yan Zeng is a Software Development Engineer with AWS Migration Hub Strategy Recommendations. The team helps customers plan migration and modernization initiatives by offering migration and modernization strategy recommendations for viable transformation paths for customers' applications.