

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

# **eb migrate**
<a name="eb3-migrate"></a>

## 説明
<a name="eb3-migratedescription"></a>

Internet Information Services (IIS) サイトとアプリケーションを Windows サーバーから Elastic Beanstalk に移行します。コマンドは、アプリケーションをパッケージ化し、設定を保持し、新しい Elastic Beanstalk 環境にデプロイします。

IIS サイトとアプリケーションの移行の詳細については、「[IIS アプリケーションを Elastic Beanstalk に移行する](dotnet-migrating-applications.md)」を参照してください。

**注記**  
このコマンドを使用する前に、システムが次の要件を満たしていることを確認してください。  
Internet Information Services (IIS) バージョン 7.0 以降
Web Deploy 3.6 以降がインストールされている
Windows サーバーの管理者権限
AWS 適切なアクセス許可で設定された 認証情報
ソースサーバーには、 AWS サービスへのアウトバウンドインターネットアクセスがあります。

以下のステップは、移行プロセスを要約しています。

1. IIS サイトとその設定を検出します。

1. アプリケーションのコンテンツと設定をパッケージ化します。

1. Elastic Beanstalk 環境とアプリケーションを作成します。

1. 保存された設定でアプリケーションをデプロイします。

コマンドは、次のリストに示すように、構造化ディレクトリに移行アーティファクトを作成します。

```
C:\migration_workspace\
└── .\migrations\latest\
    ├── upload_target.zip
    └── upload_target\
        ├── [SiteName].zip                      # One ZIP per default application of IIS site
        ├── [SiteName-ApplicationName].zip      # One ZIP per additional application
        ├── aws-windows-deployment-manifest.json
        └── ebmigrateScripts\
            ├── site_installer.ps1              # Site installation scripts
            ├── permission_handler.ps1          # Permission management
            └── other helper scripts
```

**eb migrate cleanup** を使用して、これらのアーティファクトを管理します。

## 構文
<a name="eb3-migratesyntax"></a>

**eb migrate *[options]***

**eb migrate explore *[options]***

**eb migrate cleanup *[options]***

引数なしで実行すると、**eb migrate** は非インタラクティブモードで動作します。インタラクティブモードで実行するには、**eb migrate --interactive** を実行します。

インタラクティブモードコマンドは、次の情報を求めます。
+ 移行する IIS サイトの選択
+ 環境名とアプリケーション名
+ プラットフォームバージョンの選択
+ インスタンスタイプおよびその他の設定オプション

## サブコマンド
<a name="eb3-migratesubcommands"></a>

### 探索
<a name="eb3-migrateexplore"></a>

**eb migrate explore** サブコマンドは IIS サーバーを調べ、利用可能なサイトを一覧表示します。

このコマンドを使用して、次の情報を表示します。
+ サーバー上のすべての IIS サイトを表示する
+ `--verbose` を使用して、以下を含む詳細な設定を検査します。
  + サイトバインディングとポート
  + アプリケーションプール
  + 仮想ディレクトリとその物理パス
  + 認証設定

```
PS C:\migrations_workspace >  eb migrate explore
Default Web Site
Site2
site3
router
```

```
PS C:\migrations_workspace >  eb migrate explore --verbose
1: Default Web Site:
  - Bindings:
    - *:8083:
  - Application '/':
    - Application Pool: DefaultAppPool
    - Enabled Protocols: http
    - Virtual Directories:
      - /:
        - Physical Path: C:\inetpub\wwwroot
        - Logon Method: ClearText
  - Application '/dotnet-6-0':
    - Application Pool: DefaultAppPool
    - Enabled Protocols: http
    - Virtual Directories:
      - /:
        - Physical Path: C:\inetpub\AspNetCoreWebApps\CoreWebApp-6-0
        - Logon Method: ClearText
  - Application '/dotnet-8-0':
    - Application Pool: DefaultAppPool
    - Enabled Protocols: http
    - Virtual Directories:
      - /:
        - Physical Path: C:\inetpub\AspNetCoreWebApps\CoreWebApp-8-0
        - Logon Method: ClearText
2: Site2:
  - Bindings:
    - *:8081:
...
```

### クリーンアップ
<a name="eb3-migratecleanup"></a>

**eb migrate cleanup** サブコマンドは、次のアクションを使用して移行アーティファクトを管理します。
+ `./migrations/latest` で最後に成功した移行を保持する
+ 古い移行ディレクトリを削除する
+ 重要な設定ファイルを維持する

```
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
```

## オプション
<a name="eb3-migrateoptions"></a>

これらのオプションはいずれも必須ではありません。オプションなしで **eb migrate** を実行すると、EB CLI は非インタラクティブモードで実行されます。**eb migrate --interactive** では、EB CLI により、必要な設定の値を入力または選択するように求められます。


****  

|  名前  |  説明  | 
| --- | --- | 
|  `-a` *application-name* または `--application-name` *application-name*  |  新しい Elastic Beanstalk アプリケーションの名前。 タイプ: 文字列 デフォルト: EBMigratedApp  | 
|  `--archive` *directory-or-zip*  |  **eb migrate --archive-only** によって以前に生成されたソースコードを含むディレクトリまたは ZIP ファイル。 このオプションを使用して、以前に作成した移行パッケージをデプロイします。 例: `--archive .\migrations\latest\upload_target` または `--archive .\migrations\latest\upload_target.zip`  | 
|  `-ao` または `--archive-only`  |  デプロイなしで送信先アーカイブディレクトリのみを作成します。 結果のディレクトリは、`archive` オプションとともに **eb migrate**、または **eb deploy** を使用して手動でデプロイできます。  | 
|  `-c` *subdomain-name* または `--cname` *subdomain-name*  |  移行したアプリケーションの CNAME DNS エントリのプレフィックスとなるサブドメイン名。 タイプ: 文字列 デフォルト: 環境の名前  | 
|  `-cf` または `--copy-firewall-config`  |  アクティブなバインディングを持つすべての HTTP ポートに対して、ソースサーバーのファイアウォール設定を送信先にコピーします。 対応するセキュリティグループルールを作成します AWS。  | 
|  `-es` *snapshot-id* [*snapshot-id* ...] または `--ebs-snapshots` *snapshot-id* [*snapshot-id* ...]  |  環境に関連付ける Amazon EBS スナップショット ID のカンマ区切りリスト。 例: `--ebs-snapshots snap-1234567890abcdef0, snap-0987654321fedcba1`  | 
|  `--encrypt-ebs-volumes`  |  すべての新しい Amazon EBS ボリュームに暗号化を強制します。  これは、すべての今後の Amazon EBS ボリュームの作成に影響するアカウント全体の設定です。   | 
|  `-e` *環境名* または `--environment-name` *環境名*  |  新しい Elastic Beanstalk 環境の名前。 タイプ: 文字列 デフォルト: EBMigratedEnv 制約: 4～40 文字の長さにする必要があります。英字、数字、ハイフンのみを使用できます。ハイフンでスタートまたは終了することはできません。  | 
|  `--force`  |  オペレーション中に確認プロンプトをスキップします。 **cleanup** サブコマンドで使用すると、確認なしで移行アーティファクトを削除します。  | 
|  `-ip` *プロファイル名* または `--instance-profile` *プロファイル名*  |  環境の Amazon EC2 インスタンスに関連付けるインスタンスプロファイル。 指定しない場合、Elastic Beanstalk リソースにアクセスするアクセス許可を持つデフォルトのインスタンスプロファイルを作成します。詳細については、「[Elastic Beanstalk インスタンスプロファイル](concepts-roles-instance.md)」を参照してください。  | 
|  `-i` *インスタンスタイプ* または `--instance-type` *インスタンスタイプ*  |  Elastic Beanstalk 環境に対する Amazon EC2 インスタンスタイプ。 タイプ: 文字列 デフォルト: c5.2xlarge 利用可能なインスタンスタイプについては、「*Amazon EC2 ユーザーガイド*」の「[Amazon EC2 インスタンスタイプ](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html)」を参照してください。  | 
|  `-in` または `--interactive`  |  移行プロセスの強制インタラクティブモード。 デフォルトが使用可能な場合でも、設定値を求めます。  | 
|  `-k` *key-name* または `--keyname` *key-name*  |  環境インスタンスへの RDP アクセスを有効にする Amazon EC2 キーペア。 ログに表示されないインスタンスレベルの問題の調査に役立ちます。 有効な値: Amazon EC2 に登録された既存のキーペア名  | 
|  `-p` *platform-version* または `--platform` *platform-version*  |  環境の Elastic Beanstalk プラットフォームランタイム。指定しない場合、ホスト Windows Server バージョンから自動的に検出されます。 例: `"64bit Windows Server 2016 v2.16.2 running IIS 10.0"` 使用可能なプラットフォームバージョンのリストについては、[eb platform list](eb3-platform.md#eb3-platform-list) を使用します。  | 
|  `--remote`  |  リモートモードで移行を実行することを示します。このオプションを使用すると、踏み台ホストから実行できます。踏み台ホストは、Elastic Beanstalk に移行されるアプリケーションと設定を含むターゲットサーバーに接続します。踏み台サーバーから実行すると、`eb migrate` は設定を検出し、踏み台ホストで移行ロジックをステージングしてから、アプリケーションを新しい Elastic Beanstalk 環境にデプロイします。 このオプションを使用すると、移行する必要がある Windows サーバーに EB CLI と Python をインストールする必要がなくなります。代わりに踏み台ホストに Python と EB CLI をインストールします。ここでは、**eb migrate** コマンドを `--remote` オプションで実行します。`--target-ip` オプションを使用して、移行する IIS 設定を持つホストを指定します。 `--target-ip`、`--username`、および `--password` とともに使用する必要があります。  | 
|  `--target-ip` *ip-address*  |  移行される IIS サーバーを含むリモート Windows マシンのパブリック IP アドレス。 `--remote` の使用時には必須です。`--remote` を使用する場合にのみ指定できます。  | 
|  `--username` *username*  |  移行する IIS サーバーを含むリモート Windows マシンにアクセスするためのユーザープロファイルのユーザー名。 `--remote` の使用時には必須です。`--remote` を使用する場合にのみ指定できます。  | 
|  `--password` *password*  |  移行する IIS サーバーを含むリモート Windows マシンにアクセスするためのユーザープロファイルのパスワード。 `--remote` の使用時には必須です。`--remote` を使用する場合にのみ指定できます。  | 
|  `-sr` *role-name* または `--service-role` *role-name*  |  Elastic Beanstalk が関連サービスを管理するための IAM AWS サービスロール。 指定しない場合、必要なアクセス許可を持つデフォルトのサービスロールを作成します。詳細については、「[Elastic Beanstalk サービスロール](concepts-roles-service.md)」を参照してください。  完全な ARN ではなく、ロール名のみを指定します。Elastic Beanstalk は完全な ARN を自動的に作成します。   | 
|  `-s` *site-names* または `--sites` *site-names*  |  移行する IIS サイトのカンマ区切りのリスト。指定しない場合、サーバー上の利用可能なすべてのサイトを移行します。 例: `--sites "Default Web Site,Intranet,API"`  | 
|  `--ssl-certificates` *certificate-arn*[,*certificate-arn* ...]  |  Application Load Balancer に関連付ける ACM SSL 証明書 ARN のカンマ区切りのリスト。 HTTPS バインディングを使用してサイトを移行する場合に必要です。 例: `--ssl-certificates arn:aws:acm:region:account:certificate/certificate-id`  | 
|  `-t key1=value1[,key2=value2 ...]` または `-﻿-﻿tags key1=value1[,key2=value2 ...]`  |  環境内の新しいリソースにタグを付けるための `key=value` ペアのカンマ区切りのリスト: 環境、Elastic Beanstalk アプリケーション、アプリケーションバージョン。 詳細については、「[環境のタグ付け](using-features.tagging.md)」を参照してください。  | 
|  `--verbose`  |  移行プロセス中に詳細情報を表示します。 **explore** サブコマンドとともに使用すると、包括的なサイト設定の詳細を表示します。  | 
|  `-vpc` *config-file-or-string* または `--vpc-config` *config-file-or-string*  |  環境の VPC 設定。JSON ファイルパスまたは JSON 文字列として指定します。 設定には以下を含める必要があります。 <pre>{<br />    "id": "vpc-1234567890abcdef0",<br />    "publicip": "true|false",<br />    "elbscheme": "public|private",<br />    "ec2subnets": ["subnet-a1b2c3d4", "subnet-e5f6g7h8"],<br />    "securitygroups": "sg-123456,sg-789012",<br />    "elbsubnets": ["subnet-a1b2c3d4", "subnet-e5f6g7h8"]<br />}</pre> [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/dg/eb3-migrate.html)  `--vpc-config` *パラメータ**を指定すると、移行はソース環境からの既存の VPC 設定を無視します*。このパラメータを使用する場合、移行では、渡す設定ファイルで指定された VPC 設定のみを使用します。このパラメータを使用すると、ソースインスタンスの VPC 設定を検出するか、デフォルトの VPC を使用するというデフォルトの動作が上書きされます。   | 
|  [一般的なオプション](eb3-cmd-options.md)  |  | 

## Output
<a name="eb3-migrateoutput"></a>

コマンドは、移行プロセス全体でステータスの更新を提供します。

1. VPC 設定検出 (EC2 インスタンスで実行されている場合)

1. 各サイトのソースバンドル生成の進行状況

1. 環境の作成ステータス

1. デプロイの進捗状況

成功すると、以下を含む新しい環境の詳細が表示されます。
+ 環境名と ID
+ アプリケーション名
+ リージョン
+ プラットフォームバージョン
+ 環境 CNAME

移行中の問題については、[**eb events**](eb3-events.md) および [**eb health**](eb3-health.md) コマンドを使用して詳細情報を取得します。

## 例
<a name="eb3-migrateexamples"></a>

### 基本的な使用法
<a name="eb3-migrateexamples-basic"></a>

インタラクティブモードでの基本的な移行:

```
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

Creating application version
Creating environment

Environment details for: EBMigratedEnv
  Application name: EBMigratedApp
  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: ebmigratedenv.us-west-2.elasticbeanstalk.com
  Updated: 2023-03-20 15:30:45
```

カスタム設定を使用した特定のサイトの移行:

```
PS C:\migrations_workspace >  eb migrate `
    --sites "Default Web Site,InternalAPI" `
    --application-name "CorporateApp" `
    --environment-name "Production" `
    --instance-type "c5.xlarge" `
    --tags "Environment=Production,Team=WebOps" `
    --copy-firewall-config
```

デプロイなしで移行アーカイブの作成:

```
PS C:\migrations_workspace >  eb migrate --archive-only
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

Generated destination archive directory at .\migrations\latest\upload_target
You can execute `eb init` and `eb create` from this directory to deploy to EB.
```

### 高度な設定の例
<a name="eb3-migrateexamples-advanced"></a>

JSON ファイルを使用したカスタム VPC 設定による移行:

```
PS C:\migrations_workspace >  cat vpc-config.json
{
    "id": "vpc-1234567890abcdef0",
    "publicip": "false",
    "elbscheme": "internal",
    "ec2subnets": [
        "subnet-private1",
        "subnet-private2"
    ],
    "securitygroups": [
        "sg-app",
        "sg-database",
        "sg-monitoring"
    ],
    "elbsubnets": [
        "subnet-private1",
        "subnet-private2"
    ]
}

PS C:\migrations_workspace eb migrate `
    --sites "InternalAPI" `
    --vpc-config vpc-config.json `
    --instance-type "r5.xlarge" `
    --tags "Environment=Internal,Security=High"
```

SSL 証明書とホストヘッダーを使用したサイトの移行:

```
PS C:\migrations_workspace >  eb migrate `
    --sites "SecurePortal" `
    --ssl-certificates "arn:aws:acm:region:account:certificate/cert1,arn:aws:acm:region:account:certificate/cert2" `
    --verbose
INFO: Detected HTTPS bindings:
  - www.example.com:443
  - api.example.com:443

INFO: Configuring Application Load Balancer with SSL certificates
INFO: Creating host-based routing rules:
  - www.example.com -> target group 1
  - api.example.com -> target group 2
```

EBS スナップショット設定を使用した移行:

```
PS C:\migrations_workspace >  eb migrate `
    --sites "Default Web Site" `
    --ebs-snapshots "snap-1234567890abcdef0" "snap-0987654321fedcba1" `
    --encrypt-ebs-volumes
Using .\migrations\latest to contain artifacts for this migration run.
INFO: Enabling EBS encryption for all new volumes in us-west-2
INFO: Configuring environment with specified EBS snapshots
```

### セキュリティ設定の例
<a name="eb3-migrateexamples-security"></a>

複雑なファイアウォールルールを使用したサイトの処理:

```
PS C:\migrations_workspace >  eb migrate `
    --sites "Default Web Site,ReportingService" `
    --copy-firewall-config `
    --verbose
INFO: Detected the following Windows Firewall rules:
  - Allow Web Traffic (TCP 80, 443)
  - Allow Reporting Traffic (TCP 8081)
INFO: Creating corresponding security group rules
```

カスタム IAM ロールを使用した移行:

```
PS C:\migrations_workspace >  eb migrate `
    --sites "SecureApp" `
    --instance-profile "CustomInstanceProfile" `
    --service-role "CustomServiceRole"
```

### リモート実行の例
<a name="eb3-migrateexamples-remote"></a>

リモート Windows サーバーからの IIS アプリケーションの移行:

```
PS C:\migrations_workspace >  eb migrate `
    --remote `
    --target-ip "192.0.2.10" `
    --username "administrator" `
    --password "YourPassword123" `
    --application-name "RemoteApp" `
    --environment-name "RemoteEnv"
INFO: Establishing SSH connection to remote host 192.0.2.10...
INFO: Connection established
INFO: Discovering IIS sites on remote host...
INFO: Found 2 sites: Default Web Site, API
INFO: Extracting site configurations...
INFO: Generating source bundle for sites, applications, and virtual directories...
  Default Web Site/ -> .\migrations\latest\upload_target\DefaultWebSite.zip
  API/ -> .\migrations\latest\upload_target\API.zip

Creating application version
Creating environment

Environment details for: RemoteEnv
  Application name: RemoteAppstage mi
  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: remoteenv.us-west-2.elasticbeanstalk.com
  Updated: 2023-03-20 15:30:45
```

特定のサイト選択によるリモート移行:

```
PS C:\migrations_workspace >  eb migrate `
    --remote `
    --target-ip "192.0.2.10" `
    --username "administrator" `
    --password "YourPassword123" `
    --sites "API" `
    --instance-type "c5.large"
```