

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 現代化 CardDemo 大型主機應用程式 AWS Transform
<a name="modernize-carddemo-mainframe-app"></a>

*Santosh Kumar Singh 和 Cheryl du Preez，Amazon Web Services*

## 摘要
<a name="modernize-carddemo-mainframe-app-summary"></a>

[AWS Transform](https://docs.aws.amazon.com/transform/latest/userguide/what-is-service.html) 旨在加速大型主機應用程式的現代化。它使用生成式 AI 來簡化大型主機現代化程序。它可自動化複雜的任務，例如：舊版程式碼分析、大型主機文件、商業規則擷取、單體應用程式分解為商業網域，以及程式碼重構。它透過自動化複雜的任務來加速現代化專案，例如應用程式分析和遷移序列規劃。分解單體應用程式時， AWS Transform 智慧排序大型主機應用程式轉換，這可協助您平行 轉換業務功能。 AWS Transform 可以加速決策並增強操作敏捷性和遷移效率。

此模式提供step-by-step指示，協助您 AWS Transform 使用 [CardDemo](https://github.com/aws-samples/aws-mainframe-modernization-carddemo) 來測試 的大型主機現代化功能，這是範例開放原始碼大型主機應用程式。

## 先決條件和限制
<a name="modernize-carddemo-mainframe-app-prereqs"></a>

**先決條件**
+ 作用中 AWS 帳戶
+ AWS IAM Identity Center，[已啟用](https://docs.aws.amazon.com/singlesignon/latest/userguide/enable-identity-center.html)
+ 允許管理員啟用 [的許可](https://docs.aws.amazon.com/transform/latest/userguide/security_iam_id-based-policy-examples.html#id-based-policy-examples-admin-enable-transform) AWS Transform
+ 允許管理員接受 AWS Transform Web 應用程式的 Amazon Simple Storage Service (Amazon S3) 連線請求的[許可](https://docs.aws.amazon.com/transform/latest/userguide/security_iam_id-based-policy-examples.html#id-based-policy-examples-admin-connector) 

**限制**
+ AWS Transform 僅適用於部分 AWS 區域。如需支援區域的完整清單，請參閱[支援的 區域 AWS Transform](https://docs.aws.amazon.com/transform/latest/userguide/regions.html)。
+ AWS Transform 支援從常見商業導向語言 (COBOL) 到 Java 的程式碼分析、文件產生、業務規則擷取、分解和重構。如需詳細資訊，請參閱[功能和主要功能](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe.html#transform-app-mainframe-features)，以及[大型主機應用程式轉換支援的檔案類型](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe.html#transform-app-mainframe-supported-files)。
+ 中有大型主機轉換功能的服務配額 AWS Transform。如需詳細資訊，請參閱 [的配額 AWS Transform](https://docs.aws.amazon.com/transform/latest/userguide/transform-limits.html)。
+ 若要在共用工作區上協作，所有使用者都必須是與 AWS Transform Web 應用程式執行個體 AWS IAM Identity Center 相關聯的相同 執行個體的註冊使用者。
+ Amazon S3 儲存貯體和 AWS Transform 必須位於相同的 AWS 帳戶 和 區域。

## Architecture
<a name="modernize-carddemo-mainframe-app-architecture"></a>

下圖顯示您在此模式中設定的架構。

![\[使用 AWS 轉換來現代化存放在 Amazon S3 儲存貯體中的大型主機應用程式。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/0e539474-b733-452d-b0fb-6b3f4cbd5075/images/75be6d78-5b43-448c-ad07-bf74b9ae14ad.png)


該圖顯示以下工作流程：

1. AWS Transform 使用連接器來存取存放在 Amazon S3 儲存貯體中的 CardDemo 大型主機應用程式。

1. AWS Transform 使用 AWS IAM Identity Center 來管理使用者存取和身分驗證。系統會實作多層安全控制以進行身分驗證、授權、加密和存取管理，以協助在處理期間保護程式碼和成品。使用者透過聊天界面與 AWS Transform 客服人員互動。您可以為 AI 代理器提供英文特定任務的說明。如需詳細資訊，請參閱 AWS Transform 文件[中的循環中的人工 (HITL)](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe.html#transform-app-mainframe-hitl)。

1. AI 代理程式會解譯使用者的指示、建立任務計畫、將任務分割為可執行任務，以及自動執行動作。使用者可以檢閱和核准轉換。轉換任務包括下列項目：
   + **程式碼分析** – AWS Transform 分析每個檔案中的程式碼，以取得檔案名稱、檔案類型、程式碼行及其路徑等詳細資訊。代理程式會分析原始程式碼、執行分類、建立相依性映射，以及識別任何遺失的成品。它也會識別重複的元件。
   + **文件產生** – AWS Transform 產生大型主機應用程式的文件。透過分析程式碼，它可以自動建立應用程式的詳細文件，包括存在於舊版系統中的商業邏輯、流程、整合和相依性的說明。
   + **業務邏輯擷取** - AWS Transform 分析 COBOL 程式以記錄其核心業務邏輯，協助您了解基本業務邏輯。
   + **程式碼分解** – 將程式碼 AWS Transform 分解為考量程式與元件之間相依性的網域。將相同網域中的相關檔案和程式分組可改善組織，並在將其分解為較小的元件時協助保留應用程式的邏輯結構。
   + **遷移波動規劃** – 根據您在分解階段建立的網域， 會以建議的現代化順序 AWS Transform 產生遷移波動計劃。
   + **程式碼重構** – 將所有或所選網域檔案中的程式碼 AWS Transform 重構為 Java 程式碼。此步驟的目標是保留應用程式的關鍵商業邏輯，同時將其重構為現代化、雲端最佳化的 Java 應用程式。

1. AWS Transform 會將重構程式碼、產生的文件、相關聯的成品和執行時間程式庫存放在 Amazon S3 儲存貯體中。您可以執行下列動作：
   + 存取 Amazon S3 儲存貯體中的執行時間資料夾。
   + 遵循 AWS Transform 文件中的建置和部署[現代化應用程式，以建置和部署](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow-build-deploy.html)應用程式。
   + 透過聊天界面，請求和下載範例 AWS CloudFormation AWS Cloud Development Kit (AWS CDK)，或 Hashicorp Terraform 範本。這些範本可協助您部署支援重構應用程式所需的 AWS 資源。
   + 使用 [Reforge](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html#transform-app-mainframe-workflow-refactor-code-reforge) 透過使用大型語言模型 (LLMs) 來改善重構程式碼的品質。重構引擎會保留 COBOL 的功能等效性，同時將其轉換為 Java 程式碼。Reforge 是轉換後可用的選用步驟。此步驟使用 LLMs 來重組程式碼，使其與原生 Java 非常相似，這可以改善可讀性和可維護性。Reforge 也新增了人類可讀的註解，以協助您了解程式碼，並實作現代編碼模式和最佳實務。

## 工具
<a name="modernize-carddemo-mainframe-app-tools"></a>

**AWS 服務**
+ [AWS Transform](https://docs.aws.amazon.com/transform/latest/userguide/what-is-service.html) 使用代理式 AI 來協助您加速傳統工作負載的現代化，例如 .NET、大型主機和 VMware 工作負載。
+ [AWS IAM Identity Center](https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html) 可協助您集中管理 AWS 帳戶 和雲端應用程式的單一登入 (SSO) 存取。
+ [Amazon Simple Storage Service (Amazon S3)](https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html) 是一種雲端型物件儲存服務，可協助您儲存、保護和擷取任何數量的資料。

**程式碼儲存庫**

您可以使用開放原始碼 AWS [CardDemo](https://github.com/aws-samples/aws-mainframe-modernization-carddemo) 大型主機應用程式做為範例應用程式，以開始使用大型主機現代化。

## 最佳實務
<a name="modernize-carddemo-mainframe-app-best-practices"></a>
+ **從小**開始 – 從較不複雜的小程式碼 (15，000–20，000 行程式碼） 開始，以了解 如何 AWS Transform 分析和轉換大型主機應用程式。
+ **結合人類專業知識** – AWS Transform 用作加速器，同時套用人類專業知識以獲得最佳結果。
+ **徹底檢閱和測試** – 務必仔細檢閱轉換後的程式碼，並在轉換後執行全面的測試，以驗證功能等效性。
+ **提供意見回饋** – 若要提供意見回饋和改進建議，請使用 中的**傳送意見回饋**按鈕， AWS 管理主控台 或使用 建立案例[AWS 支援](https://support.console.aws.amazon.com/)。如需詳細資訊，請參閱[建立支援案例](https://docs.aws.amazon.com/awssupport/latest/user/case-management.html)。您的輸入對於服務增強和未來的開發很有價值。

## 史詩
<a name="modernize-carddemo-mainframe-app-epics"></a>

### 準備大型主機應用程式
<a name="prepare-the-mainframe-application"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 建立儲存貯體。 | 在啟用 的相同 AWS 帳戶 和區域中建立 Amazon S3 AWS Transform 儲存貯體。您可以使用此儲存貯體來存放大型主機應用程式程式碼， AWS Transform 並使用此儲存貯體來存放產生的文件、重構程式碼，以及與轉換相關聯的其他檔案。如需說明，請參閱 Amazon S3 文件中的[建立儲存貯](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html)體。 | 一般 AWS | 
| 準備範例大型主機應用程式。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/modernize-carddemo-mainframe-app.html) | 應用程式開發人員、DevOps 工程師 | 

### 設定 IAM Identity Center 和 AWS Transform
<a name="configure-sso-and-trn"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 將使用者新增至 IAM Identity Center。 | 將您的潛在使用者新增至 IAM Identity Center。遵循 AWS Transform 文件中在 [IAM Identity Center 中新增使用者](https://docs.aws.amazon.com/transform/latest/userguide/transform-user-management.html#transform-add-idc-users)的指示。 | AWS 管理員 | 
| 啟用 AWS Transform 並新增使用者。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/modernize-carddemo-mainframe-app.html) | AWS 管理員 | 
| 設定使用者存取 AWS Transform Web 應用程式。 | 每個使用者都必須接受存取 AWS Transform Web 應用程式的邀請。遵循 AWS Transform 文件中[接受邀請](https://docs.aws.amazon.com/transform/latest/userguide/transform-user-onboarding.html#transform-user-invitation)的指示。 | 應用程式開發人員、應用程式擁有者 | 
| 登入 AWS Transform Web 應用程式。 | 遵循[登入 AWS Transform](https://docs.aws.amazon.com/transform/latest/userguide/transform-user-onboarding.html#transform-user-signin)中的指示。 | 應用程式開發人員、應用程式擁有者 | 
| 設定工作區。 | 設定工作區，讓使用者可以在 AWS Transform Web 應用程式中協作。請遵循 AWS Transform 文件中[啟動專案](https://docs.aws.amazon.com/transform/latest/userguide/transform-environment.html#start-workflow)中的指示。 | AWS 管理員 | 

### 轉換大型主機應用程式
<a name="transform-the-mainframe-application"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 建立轉換任務。 | 建立轉換任務以現代化 CardDemo 大型主機應用程式。如需說明，請參閱 AWS Transform 文件中的[建立和啟動任務](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html#transform-app-mainframe-workflow-start-job)。當您被要求在 AWS Transform 聊天界面中設定目標時，請選擇**執行大型主機現代化 (IBM z/OS 至 AWS)**，然後選擇**分析程式碼、產生技術文件、商業邏輯、分解程式碼、計劃遷移序列，以及將程式碼轉換為 Java**。 | 應用程式開發人員、應用程式擁有者 | 
| 設定連接器。 | 建立 Amazon S3 儲存貯體的連接器，其中包含 CardDemo 大型主機應用程式。此連接器允許 AWS Transform 存取儲存貯體中的資源，並執行連續的轉換函數。如需說明，請參閱 AWS Transform 文件中的[設定連接器](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html#transform-app-mainframe-workflow-setup-connector)。 | AWS 管理員 | 
| 執行程式碼分析。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/modernize-carddemo-mainframe-app.html)如需詳細資訊，請參閱 AWS Transform 文件中的[程式碼分析](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html#transform-app-mainframe-workflow-code-analysis)。 | 應用程式開發人員、應用程式擁有者 | 
| 產生技術文件。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/modernize-carddemo-mainframe-app.html)如需詳細資訊，請參閱 [文件中的產生技術](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html#transform-app-mainframe-workflow-generate-documentation) AWS Transform 文件。 | 應用程式開發人員、應用程式擁有者 | 
| 擷取商業邏輯。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/modernize-carddemo-mainframe-app.html)如需詳細資訊，請參閱 AWS Transform 文件中的[擷取商業邏輯](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html#transform-app-mainframe-workflow-extract-business-logic)。 | 應用程式開發人員、應用程式擁有者 | 
| 分解程式碼。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/modernize-carddemo-mainframe-app.html)如需分解和種子的詳細資訊，請參閱 AWS Transform 文件中的[分解](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html#transform-app-mainframe-workflow-decomposition)。 | 應用程式開發人員、應用程式擁有者 | 
| 規劃遷移波紋。 | 規劃 CardDemo 應用程式的遷移波紋。遵循 AWS Transform 文件中的[遷移波動規劃](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html#transform-app-mainframe-workflow-wave-planning)中的指示，以檢閱和編輯波動計畫。 | 應用程式開發人員、應用程式擁有者 | 
| 重構程式碼。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/modernize-carddemo-mainframe-app.html) | 應用程式開發人員、應用程式擁有者 | 
| （選用） 使用 Reforge 改善 Java 程式碼。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/modernize-carddemo-mainframe-app.html)如需詳細資訊，請參閱 AWS Transform 文件中的[重新建構](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html#transform-app-mainframe-workflow-refactor-code-reforge)。 | 應用程式開發人員、應用程式擁有者 | 
| 簡化部署。 | AWS Transform 可以為 CloudFormation AWS CDK或 Terraform 提供基礎設施做為程式碼 (IaC) 範本。這些範本可協助您部署核心元件，包括運算、資料庫、儲存和安全資源。[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/modernize-carddemo-mainframe-app.html)如需詳細資訊，請參閱 AWS Transform 文件中的[部署功能](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html#transform-app-mainframe-features-deployment)。 | 應用程式開發人員、應用程式擁有者 | 

## 疑難排解
<a name="modernize-carddemo-mainframe-app-troubleshooting"></a>


| 問題 | 解決方案 | 
| --- | --- | 
| 您無法在 AWS Transform Web 應用程式中檢視原始程式碼或產生的文件。 | 將政策新增至 Amazon S3 儲存貯體的 CORS 許可，以允許 AWS Transform 做為原始伺服器。如需詳細資訊，請參閱 AWS Transform 文件中的 [S3 儲存貯體 CORS 許可](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html#transform-app-mainframe-workflow-setup-connector-s3)。 | 

## 相關資源
<a name="modernize-carddemo-mainframe-app-resources"></a>

**AWS 文件**
+ [大型主機應用程式的轉換 ](https://docs.aws.amazon.com/transform/latest/userguide/transform-app-mainframe-workflow.html)(AWS Transform 文件）

**其他 AWS 資源**
+ [使用 AI 代理器搭配 加速您的大型主機現代化旅程 AWS Transform](https://aws.amazon.com/blogs/migration-and-modernization/accelerate-your-mainframe-modernization-journey-using-ai-agents-with-aws-transform/)(AWS 部落格文章）
+ [AWS Transform FAQs](https://aws.amazon.com/transform/faq/)
+ [AWS IAM Identity Center FAQs](https://aws.amazon.com/iam/identity-center/faqs/)

**影片和教學課程**
+ [Amazon Q 開發人員簡介：轉換](https://explore.skillbuilder.aws/learn/courses/21893/aws-flash-introduction-to-amazon-q-developer-transform)AWS （技能建置器）
+ [AWS re：Invent 2024 - 使用 Amazon Q Developer (YouTube) 更快速地現代化大型主機應用程式](https://www.youtube.com/watch?v=pSi0XtYfY4o) YouTube
+ [AWS re：Invent 2024 - 自動化遷移和現代化以加速轉型](https://www.youtube.com/watch?v=9FjxnEoH5wg) (YouTube)
+ [AWS re：Invent 2024 - Toyota 透過新一代 AI (YouTube) 推動創新並增強營運效率](https://www.youtube.com/watch?v=_NXc1MJenw4) YouTube

**注意**  
AWS Transform 先前稱為*大型主機的 Amazon Q Developer 轉換*。