

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# 基本的な IIS の移行を実行する
<a name="dotnet-migrating-applications-basic-migration"></a>

このセクションでは、**eb migrate** コマンドを使用して IIS アプリケーションを Elastic Beanstalk に移行するプロセスについて説明します。

## IIS 環境を探索する
<a name="dotnet-migrating-applications-basic-migration-exploring"></a>

変更を行う前に、サーバーに存在するリソースは何かを理解しておく必要があります。まず、次の例に示すように、**eb migrate explore** を実行して IIS サイトを調べます。

```
PS C:\migrations_workspace> eb migrate explore
```

このコマンドは IIS サイトを明らかにします。次のリストを参照してください。

```
Default Web Site
Intranet
API.Internal
Reports
```

バインディング、アプリケーション、仮想ディレクトリなど、各サイトの設定の詳細なビューについては、次の例に示すように、`--verbose` オプションを追加します。

```
PS C:\migrations_workspace> eb migrate explore --verbose
```

次のリストは、 コマンドが提供するユーザーの環境に関する包括的な情報を示しています。

```
1: Default Web Site:
  - Bindings:
    - *:80:www.example.com
    - *:443:www.example.com
  - Application '/':
    - Application Pool: DefaultAppPool
    - Enabled Protocols: http
    - Virtual Directories:
      - /:
        - Physical Path: C:\inetpub\wwwroot
        - Logon Method: ClearText
  - Application '/api':
    - Application Pool: ApiPool
    - Enabled Protocols: http
    - Virtual Directories:
      - /:
        - Physical Path: C:\websites\api
        - Logon Method: ClearText
2: Intranet:
...
3. API.Internal:
...
4. Reports:
...
```

### 検出出力を理解する
<a name="dotnet-migrating-applications-basic-migration-exploring-output"></a>

詳細な出力は、移行計画に関する以下の重要な情報を提供します。

サイト  
検出出力には、サーバー上のすべての IIS サイトが一覧表示されます。各サイトは名前 (「Default Web Site」、「Intranet」、「API.Internal」など) で識別され、順番に番号が付けられます。サーバーに複数のサイトが存在する場合、`eb migrate` コマンドは移行戦略に応じて、それぞれを個別に、または一緒にパッケージ化およびデプロイできます。

バインディング  
プロトコルバインディングは、サイトがどのプロトコル (HTTP/HTTPS) を使用し、どのポートで動作するかを明らかにします。バインディング情報には、ドメインベースのルーティング設定を定義するホストヘッダー要件が含まれます。

アプリケーション  
アプリケーションパスには、IIS 設定内のルートアプリケーション構造とネストされたアプリケーション構造の両方が表示されます。アプリケーションプールの割り当ては、セキュリティとリソース管理のためにアプリケーションが互いに分離される方法を示します。

仮想ディレクトリ  
物理パスマッピングは、コンテンツがファイルシステム上に存在する場所を示します。認証設定には、移行後に維持する必要がある特別なアクセス要件が表示されます。

## 移行の準備
<a name="dotnet-migrating-applications-basic-migration-preparing"></a>

環境を理解することで、サーバーが前提条件を満たしていることを確認します。まず、次の PowerShell コマンドを使用して IIS バージョンを確認します。

```
PS C:\migrations_workspace> Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\InetStp\" -Name MajorVersion
```

IIS 7.0 以降が必要です。移行ツールは、アプリケーションをパッケージ化するために Web Deploy 3.6 を使用します。次のコマンドを使用してそのインストールを確認します。



```
PS C:\migrations_workspace> Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3" -Name InstallPath
```

Web Deploy がサーバーにインストールされていない場合は、[Microsoft Web Platform Installer](https://www.iis.net/downloads/microsoft/web-deploy) ダウンロードページからダウンロードできます。

## 最初の移行
<a name="dotnet-migrating-applications-basic-migration-first"></a>

デフォルトウェブサイトの基本的な移行から始めましょう。以下の例は、最もシンプルなコマンド **eb migrate** を示しています。

```
PS C:\migrations_workspace> eb migrate
```

このコマンドは、次の出力の例に示すように、一連の自動ステップを開始します。

```
Identifying VPC configuration of this EC2 instance (i-0123456789abcdef0)
  id: vpc-1234567890abcdef0
  publicip: true
  elbscheme: public
  ec2subnets: subnet-123,subnet-456,subnet-789
  securitygroups: sg-123,sg-456
  elbsubnets: subnet-123,subnet-456,subnet-789

Using .\migrations\latest to contain artifacts for this migration run.
Generating source bundle for sites, applications, and virtual directories...
  Default Web Site/ -> .\migrations\latest\upload_target\DefaultWebSite.zip
```

移行ツールは、デプロイアーティファクトを含む構造化ディレクトリを作成します。次のリストでは、ディレクトリ構造について示しています。

```
C:\migration_workspace\
└── .\migrations\latest\
    └── upload_target\
        ├── DefaultWebSite.zip
        ├── aws-windows-deployment-manifest.json
        └── ebmigrateScripts\
            ├── site_installer.ps1
            ├── permission_handler.ps1
            └── >other helper scripts<
```

## 移行を制御する
<a name="dotnet-migrating-applications-basic-migration-controlling"></a>

移行プロセスをより詳細に制御するには、次のコマンドを使用して、移行するサイトを正確に指定できます。

```
PS C:\migrations_workspace> eb migrate --sites "Default Web Site,Intranet"
```

次のコマンドの例に示すように、環境名とアプリケーション名をカスタマイズすることもできます。

```
PS C:\migrations_workspace> eb migrate `
    --sites "Default Web Site" `
    --application-name "CorporateApp" `
    --environment-name "Production"
```

オプションの完全な一覧については、「[**eb migrate**](eb3-migrate.md)」を参照してください。

## 進行状況の監視
<a name="dotnet-migrating-applications-basic-migration-monitoring"></a>

移行中、**eb migrate** はリアルタイムのステータス更新を提供します。次の出力例を参照します。

```
...
Creating application version
Creating environment... This may take a few minutes

2024-03-18 18:12:15    INFO    Environment details for: Production
  Application name: CorporateApp
  Region: us-west-2
  Deployed Version: app-230320_153045
  Environment ID: e-abcdef1234
  Platform: 64bit Windows Server 2019 v2.7.0 running IIS 10.0
  Tier: WebServer-Standard-1.0
  CNAME: production.us-west-2.elasticbeanstalk.com
  Updated: 2024-03-20 15:30:45
2025-03-18 18:12:17    INFO    createEnvironment is starting.
2025-03-18 18:12:19    INFO    Using elasticbeanstalk-us-east-1-180301529717 as Amazon S3 storage bucket for environment data.
2025-03-18 18:12:40    INFO    Created security group named: sg-0fdd4d696a26b086a
2025-03-18 18:12:48    INFO    Environment health has transitioned to Pending. Initialization in progress (running for 7 seconds). There are no instances.
...
2025-03-18 18:23:59    INFO    Application available at EBMigratedEnv-arrreal3.us-east-1.elasticbeanstalk.com.
2025-03-18 18:24:00    INFO    Successfully launched environment: EBMigratedEnv-arrreal3
```

## 移行を検証する
<a name="dotnet-migrating-applications-basic-migration-verifying"></a>

環境の準備ができたら、Elastic Beanstalk はデプロイを検証するためのいくつかの方法を提供します。

アプリケーションにアクセスする  
ウェブブラウザでアプリケーション URL (CNAME) を開き、それが正しく動作していることを確認します。

環境の正常性を確認する  
**eb health** コマンドを使用して、環境の正常性を表示します。  

```
PS C:\migrations_workspace> eb health
```
次の画面画像は、インスタンスの正常性、アプリケーションレスポンスメトリクス、およびシステムリソース使用率を示しています。  

![eb health コマンドからの出力は、インスタンスの正常性、アプリケーションレスポンスメトリクス、およびシステムリソース使用率を示します。](http://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/dg/images/eb-health-after-migration.png)


**eb logs** コマンドを使用してログにアクセスし、問題をトラブルシューティングします。  

```
PS C:\migrations_workspace> eb logs --zip
```
**eb logs** コマンドは、`.elasticbeanstalk/logs` ディレクトリにログをダウンロードします。詳細については、「[Amazon CloudWatch Logs で Elastic Beanstalk を使用する](AWSHowTo.cloudwatchlogs.md)」を参照してください。

インスタンスに接続します  
移行中にキーペアを指定した場合は、RDP を使用してインスタンスに接続し、直接トラブルシューティングすることができます。

Elastic Beanstalk コンソールにアクセスする  
環境の正常性、ログ、および設定のプロパティは、その環境の[環境マネジメントコンソール](environments-console.md)から表示できます。

## 移行アーティファクトを管理する
<a name="dotnet-migrating-applications-basic-migration-cleanup"></a>

**eb migrate** コマンドは、移行プロセス中にローカルアーティファクトを作成します。これらのアーティファクトには機密情報が含まれており、時間の経過とともに大量のディスク容量を消費する可能性があります。次の例に示すように、**cleanup** サブコマンドを使用してこれらのアーティファクトを管理します。

```
PS C:\migrations_workspace> eb migrate cleanup
Are you sure you would like to cleanup older artifacts within ./migrations/? (Y/N):
```

確認なしで強制クリーンアップするには、**--force** オプションを使用します。

```
PS C:\migrations_workspace> eb migrate cleanup --force
```

クリーンアッププロセスは、最後に成功した移行を `./migrations/latest` ディレクトリに保持し、古い移行ディレクトリを削除します