

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

# マルチアカウント実験テンプレートを作成する
<a name="create"></a>

**を使用して実験テンプレートを作成する方法を学ぶには AWS マネジメントコンソール**  
「[実験テンプレートの作成](create-template.md)」を参照してください。

**CLI を使用して実験テンプレートを作成するには**

1. を開く AWS Command Line Interface

1. アカウントターゲティング実験オプションを `"multi-account"` に設定 (`my-template.json` など) して保存された JSON ファイルから実験を作成するには、*斜体*のプレースホルダーの値を独自の値に置き換えて、次の [create-experiment-template](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/fis/create-experiment-template.html) コマンドを実行します。

   ```
   aws fis create-experiment-template --cli-input-json file://my-template.json
   ```

   これにより、レスポンスで実験テンプレートが返されます。応答から実験テンプレートの ID である `id` をコピーします。

1. [create-target-account-configuration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/fis/create-target-account-configuration.html) コマンドを実行して、実験テンプレートにターゲットアカウント設定を追加します。ステップ 2 の `id` を `--experiment-template-id` パラメータの値として使用し、*斜体*のプレースホルダーの値を独自の値に置き換え、次を実行します。`--description` パラメータはオプションです。ターゲット アカウントごとにこのステップを繰り返します。

   ```
   aws fis create-target-account-configuration --experiment-template-id EXTxxxxxxxxx --account-id 111122223333 --role-arn arn:aws:iam::111122223333:role/role-name --description "my description"
   ```

1. [get-target-account-configuration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/fis/get-target-account-configuration.html) コマンドを実行して、特定のターゲットアカウント設定の詳細を取得します。

   ```
   aws fis get-target-account-configuration --experiment-template-id EXTxxxxxxxxx --account-id 111122223333
   ```

1. ターゲットアカウント設定をすべて追加したら、[list-target-account-configurations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/fis/list-target-account-configurations.html) コマンドを実行して、ターゲットアカウント設定が作成されたことを確認できます。

   ```
   aws fis list-target-account-configurations --experiment-template-id EXTxxxxxxxxx
   ```

   [get-experiment-template](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/fis/get-experiment-template.html) コマンドを実行して、ターゲットアカウント設定が追加されたことを確認することもできます。テンプレートは、実験テンプレートのすべてのターゲットアカウント設定の数を示す読み取り専用フィールド `targetAccountConfigurationsCount` を返します。

1. 準備ができたら、[start-experiment](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/fis/start-experiment.html) コマンドを使用して実験テンプレートを実行できます。

   ```
   aws fis start-experiment --experiment-template-id EXTxxxxxxxxx
   ```