

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

# 建立並註冊任務定義
<a name="create-array-job-def"></a>

現在您的 Docker 映像位於映像登錄檔中，您可以在 AWS Batch 任務定義中指定它。然後，您可以稍後使用它來執行陣列任務。此範例僅使用 AWS CLI。不過，您也可以使用 AWS 管理主控台。如需詳細資訊，請參閱[建立單一節點任務定義](create-job-definition.md)。

**建立任務定義**

1. 在`print-color-job-def.json`工作區目錄中建立名為 的檔案，並將以下內容貼入其中。將映像儲存庫 URI 取代為您自己的映像 URI。

   ```
   {
     "jobDefinitionName": "print-color",
     "type": "container",
     "containerProperties": {
       "image": "aws_account_id.dkr.ecr.region.amazonaws.com/print-color",
       "resourceRequirements": [
           {
               "type": "MEMORY",
               "value": "250"
           },
           {
               "type": "VCPU",
               "value": "1"
           }
       ]
     }
   }
   ```

1. 向 註冊任務定義 AWS Batch。

   ```
   $ aws batch register-job-definition --cli-input-json file://print-color-job-def.json
   ```