Skip to content

Commit 34cbd19

Browse files
authored
Merge pull request #49 from awslabs/docs/ai-analysis-readme
docs: add AI-powered analysis documentation and AWS Bedrock setup guide
2 parents 1a40627 + db0e401 commit 34cbd19

File tree

2 files changed

+240
-58
lines changed

2 files changed

+240
-58
lines changed

README.md

Lines changed: 218 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,127 +2,292 @@
22

33
### About AppServerMigration
44

5-
AppServerMigration, an open-source software solution, analyses Java applications to deliver precise effort estimations in person-days, facilitating a seamless transition from source to target states. This tool adeptly identifies necessary modifications, offers insightful recommendations, and presents a comprehensive HTML report for a well-guided migration. It accelerates the migration journey, eliminating the necessity for re-work, ensuring a successful and efficient transition with minimal setbacks. AppServerMigration employs a rule-based analysis, meticulously examining Java applications according to predefined rules. This method ensures a thorough assessment, enabling precise identification of necessary changes and providing accurate effort estimations. Effort estimations in AppServerMigration leverage QSM's (Quantitative Software Management) industry-standard metrics and incorporate the backtracking technique. Customizations are then applied, drawing from firsthand migration experiences. This tailored approach ensures precise calculations, aligning with project nuances and enhancing the accuracy of migration effort predictions.
5+
AppServerMigration, an open-source software solution, analyses Java applications to deliver precise effort estimations in person-days, facilitating a seamless transition from source to target states. This tool adeptly identifies necessary modifications, offers insightful recommendations, and presents a comprehensive HTML report for a well-guided migration. It accelerates the migration journey, eliminating the necessity for re-work, ensuring a successful and efficient transition with minimal setbacks.
6+
7+
AppServerMigration employs a rule-based analysis, meticulously examining Java applications according to predefined rules. This method ensures a thorough assessment, enabling precise identification of necessary changes and providing accurate effort estimations.
8+
9+
**NEW: AI-Powered Analysis** - AppServerMigration now includes AI-powered analysis using Amazon Bedrock, providing intelligent migration recommendations and effort estimations alongside traditional rule-based analysis.
10+
11+
Effort estimations in AppServerMigration leverage QSM's (Quantitative Software Management) industry-standard metrics and incorporate the backtracking technique. Customizations are then applied, drawing from firsthand migration experiences. This tailored approach ensures precise calculations, aligning with project nuances and enhancing the accuracy of migration effort predictions.
612

713
### Cloning the project
14+
815
```bash
916
git clone git@github.com:awslabs/app-server-migration.git
1017
cd app-server-migration
1118
```
1219

1320
### Build the project
21+
1422
Prior to building the project, ensure that you have the following tools installed in your machine:
23+
1524
- Java 8
1625
- Docker
1726
- Maven
1827
- Git
1928

2029
For Linux (Ubuntu, CentOS and RHEL) and Mac OS, you may execute the `./setup.sh` script to install the above dependencies.
2130
For Windows, kindly follow their official documentation guide for installation.
31+
2232
- Java 8
23-
- https://www.java.com/en/download/help/windows_manual_download.html
24-
- https://www.oracle.com/java/technologies/downloads/#java8-windows
33+
- https://www.java.com/en/download/help/windows_manual_download.html
34+
- https://www.oracle.com/java/technologies/downloads/#java8-windows
2535
- Docker
26-
- https://docs.docker.com/desktop/windows/install/
27-
- https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-containers
36+
- https://docs.docker.com/desktop/windows/install/
37+
- https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-containers
2838
- Maven
29-
- https://maven.apache.org/download.cgi
30-
- https://maven.apache.org/guides/getting-started/windows-prerequisites.html
31-
- https://maven.apache.org/install.html
39+
- https://maven.apache.org/download.cgi
40+
- https://maven.apache.org/guides/getting-started/windows-prerequisites.html
41+
- https://maven.apache.org/install.html
3242
- Git
33-
- https://git-scm.com/download/win
43+
- https://git-scm.com/download/win
3444

3545
Build the project using `mvn package` command.
3646

47+
### AWS Bedrock Setup (Required for AI Features)
48+
49+
To use the AI-powered analysis features, you need to configure AWS Bedrock access:
50+
51+
#### Prerequisites
52+
53+
1. **AWS Account** with access to Amazon Bedrock
54+
2. **AWS Credentials** configured on your machine (via AWS CLI, environment variables, or IAM role)
55+
3. **Model Access** - Enable Claude 3.5 Sonnet model in Amazon Bedrock
56+
57+
#### Step 1: Configure AWS Credentials
58+
59+
Ensure you have AWS credentials configured on your machine. The application will use the default AWS credential provider chain. You can configure credentials using any of these methods:
60+
61+
- AWS CLI: `aws configure`
62+
- Environment variables: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`
63+
- IAM role (if running on EC2 or other AWS services)
64+
- AWS credentials file (`~/.aws/credentials`)
65+
66+
For detailed instructions, see: [AWS CLI Configuration](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html)
67+
68+
#### Step 2: Enable Amazon Bedrock Model Access
69+
70+
Amazon Bedrock now offers simplified model access. Follow the instructions in this guide to enable Claude 3.5 Sonnet:
71+
72+
**[Simplified Amazon Bedrock Model Access Guide](https://aws.amazon.com/blogs/security/simplified-amazon-bedrock-model-access/)**
73+
74+
Key steps:
75+
76+
1. Navigate to the Amazon Bedrock Console
77+
2. Enable access to Anthropic's Claude 3.5 Sonnet model
78+
3. Model access is typically granted instantly
79+
80+
#### IAM Permissions Required
81+
82+
Ensure your AWS IAM user/role has the following permissions:
83+
84+
```json
85+
{
86+
"Version": "2012-10-17",
87+
"Statement": [
88+
{
89+
"Effect": "Allow",
90+
"Action": ["bedrock:InvokeModel"],
91+
"Resource": [
92+
"arn:aws:bedrock:*::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0"
93+
]
94+
}
95+
]
96+
}
97+
```
98+
99+
**Additional Resources:**
100+
101+
- [Amazon Bedrock User Guide](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html)
102+
- [Model Access Documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html)
103+
37104
### Run the project
105+
38106
#### For Linux and MacOS machines
107+
39108
```bash
40-
# Run Database
109+
# Run Database
41110
# During installation script may ask for password, enter your system password.
42-
# After installation AurangoDB Web interface is accessible on http://localhost:8529 (using default user name: root and password: openSesame)
111+
# After installation ArangoDB Web interface is accessible on http://localhost:8529
112+
# (using default user name: root and password: openSesame)
43113
bash arangoDB.sh
44114

45115
# Run Analyzer
46-
Option 1:
116+
Option 1:
47117
# This option is helpful when you want to check out projects from SCM and run the scan
48-
# In this mode we provide repository details of projects(which needs to be scanned)
118+
# In this mode we provide repository details of projects(which needs to be scanned)
49119
# in the configuration file and provide path of configuration file as shown below
50120

51121
./run.sh config:<path/to/configurationfile> <destination/path/> <ARANGO_USERNAME> <ARANGO_ROOT_PASSWORD> <Single or multiple comma separated rule names>
52122

53123
or
54124
Option 2:
55125
# This option is helpful when you already have source code downloaded on your machine
56-
# In this mode we provide local path of the project
126+
# In this mode we provide local path of the project
57127

58128
./run.sh source:<path/to/project> <destination/path/> <ARANGO_USERNAME> <ARANGO_ROOT_PASSWORD> <Single or multiple comma separated rule names>
59-
e.g.
129+
130+
# Example without AI:
60131
./run.sh source:/usr/example/project/ ~/test-directory root openSesame oracle-to-postgres,weblogic-to-tomcat
61132

133+
# Example with AI-powered analysis (NEW):
134+
./run.sh source:/usr/example/project/ ~/test-directory root openSesame weblogic-to-tomcat AIEnabled
62135
```
63136

64137
#### For Windows machines
138+
65139
```powershell
66140
# Run Database (default root password will be openSesame)
67-
powershell ./arangoDB.ps1 config:<path/to/configurationfile> <destination/path/> <ARANGO_USERNAME> <ARANGO_ROOT_PASSWORD>
141+
powershell ./arangoDB.ps1
142+
68143
# Run Analyzer
69-
Option 1:
144+
Option 1:
70145
# This option is helpful when you want to check out projects from SCM and run the scan
71-
# In this mode we provide repository details of projects(which needs to be scanned)
146+
# In this mode we provide repository details of projects(which needs to be scanned)
72147
# in the configuration file and provide path of configuration file as shown below
73148
74149
powershell ./run.ps1 config:<path/to/configurationfile> <destination/path/> <ARANGO_USERNAME> <ARANGO_ROOT_PASSWORD> <Single or multiple comma separated rule names>
75150
76151
or
77152
Option 2:
78153
# This option is helpful when you already have source code downloaded on your machine
79-
# In this mode we provide local path of the project
154+
# In this mode we provide local path of the project
80155
81156
powershell ./run.ps1 source:<path/to/project> <destination/path/> <ARANGO_USERNAME> <ARANGO_ROOT_PASSWORD> <Single or multiple comma separated rule names>
82-
e.g.
157+
158+
# Example without AI:
83159
powershell ./run.ps1 source:/usr/example/project/ /usr/example/project/reports root openSesame oracle-to-postgres,weblogic-to-tomcat
160+
161+
# Example with AI-powered analysis (NEW):
162+
powershell ./run.ps1 source:/usr/example/project/ /usr/example/project/reports root openSesame weblogic-to-tomcat AIEnabled
84163
```
85164

165+
### AI-Powered Analysis (NEW Feature)
166+
167+
AppServerMigration now supports AI-powered analysis using Amazon Bedrock's Claude 3.5 Sonnet model. This feature provides:
168+
169+
#### Benefits of AI Analysis
170+
171+
- **Intelligent Code Analysis**: Deep understanding of code patterns and migration challenges
172+
- **Context-Aware Recommendations**: Recommendations tailored to your specific codebase
173+
- **Comprehensive Coverage**: Analyzes files that may not be covered by predefined rules
174+
- **Detailed Explanations**: Clear descriptions of why changes are needed and how to implement them
175+
- **Effort Estimation**: AI-generated effort estimates based on code complexity
176+
177+
#### How to Enable AI Analysis
178+
179+
Add `AIEnabled` as the 6th parameter when running the analyzer:
180+
181+
```bash
182+
./run.sh source:<path/to/project> <destination/path/> <ARANGO_USERNAME> <ARANGO_ROOT_PASSWORD> <rule-names> AIEnabled
183+
```
184+
185+
**Example:**
186+
187+
```bash
188+
./run.sh source:/home/user/my-weblogic-app /home/user/reports root openSesame weblogic-to-tomcat AIEnabled
189+
```
190+
191+
#### Understanding AI Reports
192+
193+
When AI analysis is enabled, you'll receive:
194+
195+
1. **Traditional Rule-Based Report** - Standard HTML report with predefined rule matches
196+
2. **AI-Generated Report** - Separate HTML report with AI-powered findings and recommendations
197+
3. **Summary Report** - Combined view showing both traditional and AI effort estimates
198+
199+
**AI Report Features:**
200+
201+
- **AI-Generated Findings**: Specific code issues identified by AI analysis
202+
- **Smart Recommendations**: Actionable steps with priority levels (High/Medium/Low)
203+
- **File-Level Details**: Exact file paths and line numbers for each finding
204+
- **Complexity Assessment**: AI-evaluated complexity (minor/moderate/critical)
205+
- **Effort Estimation**: Person-days estimates for migration work
206+
207+
#### AI Report Structure
208+
209+
The AI report includes:
210+
211+
- **Summary Cards**: Project overview, migration path, rules generated, estimated effort
212+
- **Findings Section**: Detailed list of migration issues with:
213+
- Issue description
214+
- Affected file and line number
215+
- Complexity level
216+
- Rule ID for tracking
217+
- **Recommendations Section**: Prioritized action items with:
218+
- Recommendation title and description
219+
- Priority level (High/Medium/Low)
220+
- Number of affected files
221+
- Implementation guidance
222+
223+
#### Comparison: Traditional vs AI Analysis
224+
225+
| Feature | Traditional Analysis | AI Analysis |
226+
| --------------------- | ---------------------- | -------------------------------- |
227+
| **Coverage** | Predefined rules only | Comprehensive code understanding |
228+
| **Flexibility** | Fixed rule patterns | Adapts to code context |
229+
| **Recommendations** | Generic guidance | Context-specific advice |
230+
| **New Patterns** | Requires rule updates | Identifies novel issues |
231+
| **Effort Estimation** | Rule-based calculation | AI-evaluated complexity |
232+
233+
#### Best Practices
234+
235+
1. **Use Both Approaches**: Run with `AIEnabled` to get comprehensive analysis
236+
2. **Review AI Findings**: AI recommendations complement traditional rules
237+
3. **Prioritize by Severity**: Focus on High priority AI recommendations first
238+
4. **Validate Estimates**: Compare traditional and AI effort estimates
239+
5. **AWS Costs**: Be aware that AI analysis uses Amazon Bedrock (charges apply)
240+
241+
### Generated Reports
242+
243+
After running the analysis, you'll find the following reports in your destination directory:
244+
245+
1. **`<project-name>-Report.html`** - Traditional rule-based analysis report
246+
2. **`<project-name>-<source>-to-<target>-AI-Report.html`** - AI-powered analysis report (when AIEnabled)
247+
3. **`summaryreport.html`** - Summary of all analyzed projects with combined estimates
248+
86249
### Create custom rules
250+
87251
You may create your own rules which can be fed to the rule engine in order to assess to your source files based on your rules. There are 2 files which you need to create `rules.json` and `recommendations.json`. For reference, you can check [oracle-to-postgres-javarules.json](https://github.com/awslabs/app-server-migration/blob/main/src/main/resources/oracle-to-postgres-javarules.json) and [oracle-to-postgres-recommendations.json](https://github.com/awslabs/app-server-migration/blob/main/src/main/resources/oracle-to-postgres-recommendations.json) respectively.
88252

89253
The `rules.json` file would look like:
90254

91-
``` json
255+
```json
92256
{
93-
"analyzer": "com.amazon.aws.am2.appmig.estimate.java.JavaFileAnalyzer",
94-
"file_type": "java",
95-
"rules": [
96-
{
97-
"id": 1,
98-
"name": "Name",
99-
"description": "Detailed Description",
100-
"complexity": "minor",
101-
"rule_type": "package",
102-
"remove": {
103-
"import": ["java.sql.DriverManager","oracle.jdbc.driver.OracleDriver"]
104-
},
105-
"recommendation": 12
106-
},
107-
]
257+
"analyzer": "com.amazon.aws.am2.appmig.estimate.java.JavaFileAnalyzer",
258+
"file_type": "java",
259+
"rules": [
260+
{
261+
"id": 1,
262+
"name": "Name",
263+
"description": "Detailed Description",
264+
"complexity": "minor",
265+
"rule_type": "package",
266+
"remove": {
267+
"import": ["java.sql.DriverManager", "oracle.jdbc.driver.OracleDriver"]
268+
},
269+
"recommendation": 12
270+
}
271+
]
108272
}
109273
```
110274

111275
Understanding each key of above JSON file:
276+
112277
- `analyzer`: Canonical name of the analyzer class. In the above example, we are using [JavaFileAnalyzer.java](https://github.com/awslabs/app-server-migration/blob/main/src/main/java/com/amazon/aws/am2/appmig/estimate/java/JavaFileAnalyzer.java). You may create your own Analyzer by implementing `IAnalyzer` interface.
113278
- `file_type`: Type of source files which will be assessed
114279
- `rules`: Array of objects, each corresonding to a `rule`
115-
- `id`: Rule identifier
116-
- `name`: Name of the rule
117-
- `description`: A verbose rule description
118-
- `complexity`: AppServerMigration identifies the complexity of migration per application either as minor, major or critical, depending on the features that need to be converted to make the application target compatible. If the changes are only in the configurations and not in the code, then it is minor. Major category involves code changes. There might be features specific to the source server which are not supported on the target server. In such scenarios, the whole functionality needs to be re-written. Such categories fall under critical complexity. For instance, trying to migrate a web application from Oracle WebLogic to Apache Tomcat, which has EJB code.
119-
- `rule_type`: Denotes where to search to find a rule match. In the above example rule, it will look for `import` statements to search for imported packages. The processing logic is coded in the Analyzer.
120-
- `remove`: Action denoting elimination of attributes present inside it. In the above example, the rule will match against any `import` statement having `package` name either `java.sql.DriverManager` or `oracle.jdbc.driver.OracleDriver`.
121-
- `recommendation`: Maps to the identifier of recommendation present in the associated `recommendations.json` file.
280+
- `id`: Rule identifier
281+
- `name`: Name of the rule
282+
- `description`: A verbose rule description
283+
- `complexity`: AppServerMigration identifies the complexity of migration per application either as minor, major or critical, depending on the features that need to be converted to make the application target compatible. If the changes are only in the configurations and not in the code, then it is minor. Major category involves code changes. There might be features specific to the source server which are not supported on the target server. In such scenarios, the whole functionality needs to be re-written. Such categories fall under critical complexity. For instance, trying to migrate a web application from Oracle WebLogic to Apache Tomcat, which has EJB code.
284+
- `rule_type`: Denotes where to search to find a rule match. In the above example rule, it will look for `import` statements to search for imported packages. The processing logic is coded in the Analyzer.
285+
- `remove`: Action denoting elimination of attributes present inside it. In the above example, the rule will match against any `import` statement having `package` name either `java.sql.DriverManager` or `oracle.jdbc.driver.OracleDriver`.
286+
- `recommendation`: Maps to the identifier of recommendation present in the associated `recommendations.json` file.
122287

123288
The `recommendations.json` file would look like:
124289

125-
``` json
290+
```json
126291
"recommendations": [
127292
{
128293
"id": 1,
@@ -134,31 +299,35 @@ The `recommendations.json` file would look like:
134299
```
135300

136301
Understanding each key of above JSON file:
137-
- `recommendations`: Array of objects, each representing a recommendation.
138-
- `id`: Recommendation identifier
139-
- `name`: Name of the recommendation, which will be displayed on the report
140-
- `description`: A verbose recommendation description, which will be displayed on the report
141302

303+
- `recommendations`: Array of objects, each representing a recommendation.
304+
- `id`: Recommendation identifier
305+
- `name`: Name of the recommendation, which will be displayed on the report
306+
- `description`: A verbose recommendation description, which will be displayed on the report
142307

143308
# To run ArangoDB in local (alternative to running arango.sh)
309+
144310
---
311+
145312
##### Running in-memory graph database ArangoDB
146313

147314
`docker run -p 8529:8529 -e ARANGO_ROOT_PASSWORD=openSesame arangodb/arangodb:3.8.3`
148315

149316
##### Connecting to ArangoDB UI
317+
150318
`http://localhost:8529/`
151319

152320
##### You can find the name of the container by running
321+
153322
`docker ps`
154323

155324
To retrieve the HOST run the following command with container ID obtained from `docker ps`
156325

157326
`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <<CONTAINER ID>>`
158327

159328
##### To stop a ArangoDB database instance, run the following command
160-
`docker stop CONTAINER_NAME`
161329

330+
`docker stop CONTAINER_NAME`
162331

163332
## Security
164333

@@ -167,4 +336,3 @@ See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more inform
167336
## License
168337

169338
This project is licensed under the Apache-2.0 License.
170-

0 commit comments

Comments
 (0)