Tutorial: submit a job - Amazon Batch
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Tutorial: submit a job

After you register a job definition, you can submit it as a job to an Amazon Batch job queue. You can override many of the parameters that are specified in the job definition at runtime.

To submit a job
  1. Open the Amazon Batch console at https://console.amazonaws.cn/batch/.

  2. From the navigation bar, select the Amazon Web Services Region to use.

  3. In the navigation pane, choose Jobs.

  4. Choose Submit new job.

  5. For Name, enter a unique name for your job definition. The name can be up to 128 characters in length. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).

  6. For Job definition, choose an existing job definition for your job. For more information, see Create a single-node job definition .

  7. For Job queue, choose an existing job queue. For more information, see Create a job queue.

  8. For Job dependencies, choose Add Job dependencies.

    1. For Job id, enter the job ID for any dependencies. Then choose Add job dependencies. A job can have up to 20 dependencies. For more information, see Job dependencies.

  9. (Array jobs only) For Array size, specify an array size between 2 and 10,000.

  10. (Optional) Expand Tags and then choose Add tag to add tags to the resource. Enter a key and optional value, then choose Add tag.

  11. Choose Next page.

  12. In the Job overrides section:

    1. (Optional) For Scheduling priority, enter a scheduling priority value between 0 and 100. Higher values are given higher priority.

    2. (Optional) For Job attempts, enter the maximum number of times that Amazon Batch attempts to move the job to a RUNNABLE status. You can enter a number between 1 and 10. For more information, see Automated job retries.

    3. (Optional) For Execution timeout, enter the timeout value (in seconds). The execution timeout is the length of time before an unfinished job is terminated. If an attempt exceeds the timeout duration, it's stopped and moves to a FAILED status. For more information, see Job timeouts. The minimum value is 60 seconds.

      Important

      Don't rely on jobs that run on Fargate resources to run for more than 14 days. After 14 days, the Fargate resources might no longer be available with the job being likely terminated.

    4. (Optional) Turn on Propagate tags to propagate tags from the job and job definition to the Amazon ECS task.

  13. Expand Additional configuration.

  14. (Optional) For Retry strategy conditions, choose Add evaluate on exit. Enter at least one parameter value and then choose an Action. For each set of conditions, Action must be set to either Retry or Exit. These actions mean the following:

    • Retry – Amazon Batch retries until the number of job attempts that you specified is reached.

    • Exit – Amazon Batch stops retrying the job.

    Important

    If you choose Add evaluate on exit, configure at least one parameter and choose either an Action or choose Remove evaluate on exit.

  15. For Parameters, choose Add parameters to add parameter substitution placeholders. Then, enter a Key and an optional Value.

  16. In the Container overrides section:

    1. For Command, specify the command to pass to the container. For simple commands, enter the command as you do for a command prompt. For more complicated commands, for example with special characters), use JSON syntax.

      Note

      This parameter can't contain an empty string.

    2. For vCPUs, enter the number of vCPUs to reserve for the container. This parameter maps to CpuShares in the Create a container section of the Docker Remote API and the --cpu-shares option to docker run. Each vCPU is equivalent to 1,024 CPU shares. You must specify at least one vCPU.

    3. For Memory, enter the memory limit that's available to the container. If your container attempts to exceed the memory specified here, the container is stopped. This parameter maps to Memory in the Create a container section of the Docker Remote API and the --memory option to docker run. You must specify at least 4 MiB of memory for a job.

      Note

      To maximize your resource utilization, prioritize memory for jobs of a specific instance type. For more information, see Compute resource memory management.

    4. (Optional) For Number of GPUs, choose the number of GPUs to reserve for the container.

    5. (Optional) For Environment variables, choose Add environment variable to add environment variables as name-value pairs. These variables are passed to the container.

    6. Choose Next page.

    7. For Job review, review the configuration steps. If you need to make changes, choose Edit. When you're finished, choose Create job definition.