

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

# ステップ 2: AppSpec ファイルを作成します。
<a name="tutorial-ecs-create-appspec-file"></a>

 このセクションでは、AppSpec ファイルを作成し、[前提条件](tutorial-ecs-prereqs.md) のセクションで作成した Amazon S3 バケットにアップロードします。Amazon ECS デプロイのための AppSpec ファイル は、タスク定義、コンテナ名、およびコンテナポートを指定します。詳細については、「[Amazon ECS デプロイの AppSpec ファイルの例](reference-appspec-file-example.md#appspec-file-example-ecs)」および「[Amazon ECS デプロイ用の AppSpec の「resources」セクション](reference-appspec-file-structure-resources.md#reference-appspec-file-structure-resources-ecs)」を参照してください。

**AppSpec ファイルを作成するには**

1.  [YAML] を使用して AppSpec ファイルを作成したい場合は、`appspec.yml` という名前のファイルを作成します。JSON を使用して AppSpec ファイルを作成したい場合は、`appspec.json` という名前のファイルを作成します。

1.  AppSpec ファイルのために YAML または JSON を使用するかどうかに応じて、適切なタブを選択し、そのコンテンツを、先ほど作成した AppSpec ファイルにコピーします。`TaskDefinition` プロパティには、「[ステップ 1: Amazon ECS アプリケーションを更新する](tutorial-ecs-update-the-ecs-application.md)」セクションで書き留めたタスク定義 ARN を使用します。

------
#### [ JSON AppSpec ]

   ```
   {
     "version": 0.0,
     "Resources": [
       {
         "TargetService": {
           "Type": "AWS::ECS::Service",
           "Properties": {
             "TaskDefinition": "arn:aws:ecs:aws-region-id:aws-account-id:task-definition/ecs-demo-task-definition:revision-number",
             "LoadBalancerInfo": {
               "ContainerName": "your-container-name",
               "ContainerPort": your-container-port
             }
           }
         }
       }
     ]
   }
   ```

------
#### [ YAML AppSpec ]

   ```
   version: 0.0
   Resources:
     - TargetService:
         Type: AWS::ECS::Service
         Properties:
           TaskDefinition: "arn:aws:ecs:aws-region-id:aws-account-id:task-definition/ecs-demo-task-definition:revision-number"
           LoadBalancerInfo:
             ContainerName: "your-container-name"
             ContainerPort: your-container-port
   ```

------
**注記**  
 置き換えタスクセットは、元のタスクセットからサブネット、セキュリティグループ、プラットフォームバージョン、割り当てられたパブリック IP 値を継承します。AppSpec ファイル中でオプションのプロパティを設定することで、置き換えタスクセットのこれらの値を上書きできます。詳細については、「[Amazon ECS デプロイ用の AppSpec の「resources」セクション](reference-appspec-file-structure-resources.md#reference-appspec-file-structure-resources-ecs)」および「[Amazon ECS デプロイの AppSpec ファイルの例](reference-appspec-file-example.md#appspec-file-example-ecs)」を参照してください。

1.  このチュートリアルの前提条件として、作成済みの S3 バケットに AppSpec ファイルをアップロードします。