Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

Note: You are viewing the documentation for an older major version of the AWS CLI (version 1).

AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . batch ]

register-job-definition

Description

Registers an AWS Batch job definition.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  register-job-definition
--job-definition-name <value>
--type <value>
[--parameters <value>]
[--container-properties <value>]
[--node-properties <value>]
[--retry-strategy <value>]
[--timeout <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--job-definition-name (string)

The name of the job definition to register. Up to 128 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

--type (string)

The type of job definition.

Possible values:

  • container
  • multinode

--parameters (map)

Default parameter substitution placeholders to set in the job definition. Parameters are specified as a key-value pair mapping. Parameters in a SubmitJob request override any corresponding parameter defaults from the job definition.

Shorthand Syntax:

KeyName1=string,KeyName2=string

JSON Syntax:

{"string": "string"
  ...}

--container-properties (structure)

An object with various properties specific to single-node container-based jobs. If the job definition's type parameter is container , then you must specify either containerProperties or nodeProperties .

JSON Syntax:

{
  "image": "string",
  "vcpus": integer,
  "memory": integer,
  "command": ["string", ...],
  "jobRoleArn": "string",
  "volumes": [
    {
      "host": {
        "sourcePath": "string"
      },
      "name": "string"
    }
    ...
  ],
  "environment": [
    {
      "name": "string",
      "value": "string"
    }
    ...
  ],
  "mountPoints": [
    {
      "containerPath": "string",
      "readOnly": true|false,
      "sourceVolume": "string"
    }
    ...
  ],
  "readonlyRootFilesystem": true|false,
  "privileged": true|false,
  "ulimits": [
    {
      "hardLimit": integer,
      "name": "string",
      "softLimit": integer
    }
    ...
  ],
  "user": "string",
  "instanceType": "string",
  "resourceRequirements": [
    {
      "value": "string",
      "type": "GPU"
    }
    ...
  ],
  "linuxParameters": {
    "devices": [
      {
        "hostPath": "string",
        "containerPath": "string",
        "permissions": ["READ"|"WRITE"|"MKNOD", ...]
      }
      ...
    ]
  }
}

--node-properties (structure)

An object with various properties specific to multi-node parallel jobs. If you specify node properties for a job, it becomes a multi-node parallel job. For more information, see Multi-node Parallel Jobs in the AWS Batch User Guide . If the job definition's type parameter is container , then you must specify either containerProperties or nodeProperties .

JSON Syntax:

{
  "numNodes": integer,
  "mainNode": integer,
  "nodeRangeProperties": [
    {
      "targetNodes": "string",
      "container": {
        "image": "string",
        "vcpus": integer,
        "memory": integer,
        "command": ["string", ...],
        "jobRoleArn": "string",
        "volumes": [
          {
            "host": {
              "sourcePath": "string"
            },
            "name": "string"
          }
          ...
        ],
        "environment": [
          {
            "name": "string",
            "value": "string"
          }
          ...
        ],
        "mountPoints": [
          {
            "containerPath": "string",
            "readOnly": true|false,
            "sourceVolume": "string"
          }
          ...
        ],
        "readonlyRootFilesystem": true|false,
        "privileged": true|false,
        "ulimits": [
          {
            "hardLimit": integer,
            "name": "string",
            "softLimit": integer
          }
          ...
        ],
        "user": "string",
        "instanceType": "string",
        "resourceRequirements": [
          {
            "value": "string",
            "type": "GPU"
          }
          ...
        ],
        "linuxParameters": {
          "devices": [
            {
              "hostPath": "string",
              "containerPath": "string",
              "permissions": ["READ"|"WRITE"|"MKNOD", ...]
            }
            ...
          ]
        }
      }
    }
    ...
  ]
}

--retry-strategy (structure)

The retry strategy to use for failed jobs that are submitted with this job definition. Any retry strategy that is specified during a SubmitJob operation overrides the retry strategy defined here. If a job is terminated due to a timeout, it is not retried.

Shorthand Syntax:

attempts=integer

JSON Syntax:

{
  "attempts": integer
}

--timeout (structure)

The timeout configuration for jobs that are submitted with this job definition, after which AWS Batch terminates your jobs if they have not finished. If a job is terminated due to a timeout, it is not retried. The minimum value for the timeout is 60 seconds. Any timeout configuration that is specified during a SubmitJob operation overrides the timeout configuration defined here. For more information, see Job Timeouts in the Amazon Elastic Container Service Developer Guide .

Shorthand Syntax:

attemptDurationSeconds=integer

JSON Syntax:

{
  "attemptDurationSeconds": integer
}

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

To register a job definition

This example registers a job definition for a simple container job.

Command:

aws batch register-job-definition --job-definition-name sleep30 --type container --container-properties '{ "image": "busybox", "vcpus": 1, "memory": 128, "command": [ "sleep", "30"]}'

Output:

{
    "jobDefinitionArn": "arn:aws:batch:us-east-1:012345678910:job-definition/sleep30:1",
    "jobDefinitionName": "sleep30",
    "revision": 1
}

Output

jobDefinitionName -> (string)

The name of the job definition.

jobDefinitionArn -> (string)

The Amazon Resource Name (ARN) of the job definition.

revision -> (integer)

The revision of the job definition.