

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

# 使用 appcmd.exe 將 IIS 託管應用程式遷移至 Amazon EC2
<a name="migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd"></a>

*Deepak Kumar，Amazon Web Services*

## 總結
<a name="migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd-summary"></a>

當您將網際網路資訊服務 (IIS) 託管的應用程式遷移至 Amazon Elastic Compute Cloud (Amazon EC2) 執行個體時，您需要解決幾個身分驗證挑戰。這些挑戰包括重新輸入應用程式集區身分的網域登入資料，以及可能為適當的網站功能重新產生機器金鑰。您可以使用 AWS Directory Service 與內部部署 Active Directory 建立信任關係，或在其中建立新的受管 Active Directory AWS。此模式說明在 Amazon EC2 執行個體上使用 IIS 備份和還原功能的乾淨遷移方法。此方法使用 appcmd.exe 在目標 EC2 執行個體上解除安裝和重新安裝 IIS，以便成功遷移 IIS 託管的網站、應用程式集區身分和機器金鑰。

## 先決條件和限制
<a name="migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd-prereqs"></a>

**先決條件**
+  AWS 帳戶 目標伺服器的作用中 。
+ 具有託管網站的功能來源 IIS 伺服器。
+ 了解 IIS 工作原則，例如管理和組態。
+ 來源和目標伺服器上的系統管理員存取權。
+ 已完成將來源 IIS 伺服器遷移至目標 AWS 帳戶。您可以使用遷移工具 AWS Application Migration Service，例如 Amazon Machine Image (AMI) 快照型方法或其他遷移工具。

**限制**
+ 有些 AWS 服務 完全無法使用 AWS 區域。如需區域可用性，請參閱[AWS 依區域的服務](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/)。如需特定端點，請參閱[服務端點和配額](https://docs.aws.amazon.com/general/latest/gr/aws-service-information.html)，然後選擇服務的連結。

**產品版本**
+ IIS 8.5 或 IIS 10.0

## Architecture
<a name="migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd-architecture"></a>

**來源技術堆疊**
+ 安裝 IIS 8.5 或 IIS 10.0 的 Windows Server

**目標技術堆疊**
+ 安裝 IIS 8.5 或 IIS 10.0 的 Windows Server
+ 應用程式遷移服務

**目標架構**

下圖顯示此模式的工作流程和架構元件。

![\[將 IIS 託管應用程式遷移至 Amazon EC2 的工作流程。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/2f9f7757-b2bc-4077-b51a-700de521424c/images/36aa9b7a-d0aa-4fa4-be47-9fee43b53c22.png)


解決方案包含下列步驟：

1. 在公司資料中心的來源 IIS 伺服器上[安裝](https://docs.aws.amazon.com/mgn/latest/ug/agent-installation.html)和設定 AWS 複寫代理程式。此代理程式會啟動複寫程序，並管理 的資料傳輸 AWS。

1.  AWS 複寫代理程式會建立與 Application Migration Service [的安全連線](https://docs.aws.amazon.com/mgn/latest/ug/Agent-Related-FAQ.html#How-Communication-Secured)，並開始複寫來源伺服器資料，包括 IIS 組態、網站和應用程式檔案。

1. Application Migration Service 會使用複寫的資料在應用程式子網路中啟動 EC2 執行個體。目標 EC2 執行個體會執行 IIS，並包含已遷移的應用程式及其相關聯的 Amazon Elastic Block Store (Amazon EBS) 磁碟區。在初始複寫之後，Application Migration Service 會繼續同步變更，直到您[準備好切換](https://docs.aws.amazon.com/mgn/latest/ug/migration-dashboard.html#ready-for-cutover1)到新環境為止。

## 工具
<a name="migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd-tools"></a>

**AWS 服務**
+ [AWS Application Migration Service](https://docs.aws.amazon.com/mgn/latest/ug/what-is-application-migration-service.html) 可協助您將應用程式重新託管 (*提升和轉移*) 到 ， AWS 雲端 而無須變更且停機時間最短。
+ [Amazon Elastic Block Store (Amazon EBS)](https://docs.aws.amazon.com/ebs/latest/userguide/what-is-ebs.html) 提供區塊層級儲存體磁碟區，可搭配使用 Amazon EC2 執行個體。
+ [Amazon Elastic Compute Cloud (Amazon EC2)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html) 在 AWS 雲端中提供可擴展的運算容量。您可以視需要啟動任意數量的虛擬伺服器，，並快速進行擴展或縮減。

**其他工具**
+ 適用於 Windows Server 的[網際網路資訊服務 (IIS)](https://www.iis.net/overview) 是 Web 伺服器，具有可擴展且開放的架構，可在 Web 上託管任何內容。IIS 提供一組管理工具，包括管理和命令列工具 （例如 appcmd.exe)、受管程式碼和指令碼 APIs，以及 Windows PowerShell 支援。

## 史詩
<a name="migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd-epics"></a>

### 在遷移前於來源備份 IIS
<a name="back-up-iis-at-source-prior-to-migration"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 建立 IIS 託管網站、組態金鑰和`WAS`金鑰的備份。 | 若要為 IIS 託管網站、組態金鑰 (`iisConfigurationKey`) 和`WAS`金鑰 (`iisWasKey`) 建立備份，請在來源伺服器上使用 appcmd.exe。使用下列步驟：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd.html)若要匯出組態金鑰和`WAS`金鑰，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd.html) | IIS 管理員 | 

### 在目標伺服器上解除安裝和重新安裝 IIS
<a name="uninstall-and-reinstall-iis-on-the-target-server"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 在目標伺服器上解除安裝 IIS。 | 若要解除安裝目標伺服器上的 IIS，請使用下列步驟：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd.html) | IIS 管理員 | 
| 在目標伺服器上安裝 IIS。 | 若要在目標伺服器上安裝 IIS，請使用下列步驟：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd.html) | IIS 管理員 | 

### 從備份還原 IIS 網站和組態
<a name="restore-iis-websites-and-configuration-from-the-backups"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 還原 IIS 網站和組態。 | 若要還原您在目標伺服器上從來源伺服器建立的 IIS 備份，請使用下列步驟：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd.html) | IIS 管理員 | 

## 相關資源
<a name="migrate-iis-hosted-applications-to-amazon-ec2-by-using-appcmd-resources"></a>

**AWS 文件**
+ [安裝複寫代理程式 AWS](https://docs.aws.amazon.com/mgn/latest/ug/agent-installation.html)(AWS Application Migration Service 文件）

**AWS 方案指引**
+ [使用 將內部部署 VM 遷移至 Amazon EC2 AWS Application Migration Service](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/migrate-an-on-premises-vm-to-amazon-ec2-by-using-aws-application-migration-service.html)
+ [使用 AMIs 或 Amazon EBS 快照進行備份](https://docs.aws.amazon.com/prescriptive-guidance/latest/backup-recovery/ec2-backup.html#amis-snapshots)

**Microsoft 資源**
+ [應用程式集區身分](https://learn.microsoft.com/en-us/troubleshoot/developer/webapps/iis/was-service-svchost-process-operation/understanding-identities#application-pool-identities)
+ [IIS 文件](https://learn.microsoft.com/en-us/iis/)
+ [IIS 8 appcmd.exe 文件](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/jj635852(v=ws.11))
+ [IIS 10 appcmd.exe 文件](https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-10/new-features-introduced-in-iis-10)
+ [強大的管理員工具](https://learn.microsoft.com/en-us/iis/overview/powerful-admin-tools)