Menu
AWS Batch
API Reference (API Version 2016-08-10)

SubmitJob

Submits an AWS Batch job from a job definition. Parameters specified during SubmitJob override parameters defined in the job definition.

Request Syntax

Copy
POST /v1/submitjob HTTP/1.1 Content-type: application/json { "containerOverrides": { "command": [ "string" ], "environment": [ { "name": "string", "value": "string" } ], "memory": number, "vcpus": number }, "dependsOn": [ { "jobId": "string" } ], "jobDefinition": "string", "jobName": "string", "jobQueue": "string", "parameters": { "string" : "string" }, "retryStrategy": { "attempts": number } }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

containerOverrides

A list of container overrides in JSON format that specify the name of a container in the specified job definition and the overrides it should receive. You can override the default command for a container (that is specified in the job definition or the Docker image) with a command override. You can also override existing environment variables (that are specified in the job definition or Docker image) on a container or add new environment variables to it with an environment override.

Type: ContainerOverrides object

Required: No

dependsOn

A list of job IDs on which this job depends. A job can depend upon a maximum of 20 jobs.

Type: Array of JobDependency objects

Required: No

jobDefinition

The job definition used by this job. This value can be either a name:revision or the Amazon Resource Name (ARN) for the job definition.

Type: String

Required: Yes

jobName

The name of the job. The first character must be alphanumeric, and up to 128 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

Type: String

Required: Yes

jobQueue

The job queue into which the job will be submitted. You can specify either the name or the Amazon Resource Name (ARN) of the queue.

Type: String

Required: Yes

parameters

Additional parameters passed to the job that replace parameter substitution placeholders that are set in the job definition. Parameters are specified as a key and value pair mapping. Parameters in a SubmitJob request override any corresponding parameter defaults from the job definition.

Type: String to string map

Required: No

retryStrategy

The retry strategy to use for failed jobs from this SubmitJob operation. When a retry strategy is specified here, it overrides the retry strategy defined in the job definition.

Type: RetryStrategy object

Required: No

Response Syntax

Copy
HTTP/1.1 200 Content-type: application/json { "jobId": "string", "jobName": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

jobId

The unique identifier for the job.

Type: String

jobName

The name of the job.

Type: String

Errors

ClientException

These errors are usually caused by a client action, such as using an action or resource on behalf of a user that doesn't have permission to use the action or resource, or specifying an identifier that is not valid.

HTTP Status Code: 400

ServerException

These errors are usually caused by a server issue.

HTTP Status Code: 500

Example

In the following example or examples, the Authorization header contents (AUTHPARAMS) must be replaced with an AWS Signature Version 4 signature. For more information about creating these signatures, see Signature Version 4 Signing Process in the AWS General Reference.

You only need to learn how to sign HTTP requests if you intend to manually create them. When you use the AWS Command Line Interface (AWS CLI) or one of the AWS SDKs to make requests to AWS, these tools automatically sign the requests for you with the access key that you specify when you configure the tools. When you use these tools, you don't need to learn how to sign requests yourself.

Example

This example submits a simple container job called example to the HighPriority job queue.

Sample Request

Copy
POST /v1/submitjob HTTP/1.1 Host: batch.us-east-1.amazonaws.com Accept-Encoding: identity Content-Length: 78 Authorization: AUTHPARAMS X-Amz-Date: 20161129T201034Z User-Agent: aws-cli/1.11.22 Python/2.7.12 Darwin/16.1.0 botocore/1.4.79 { "jobName": "example", "jobQueue": "HighPriority", "jobDefinition": "sleep60" }

Sample Response

Copy
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 82 Connection: keep-alive Date: Tue, 29 Nov 2016 20:10:34 GMT x-amzn-RequestId: e2e433cf-b66f-11e6-8321-7fedcfd554e5 X-Amzn-Trace-Id: Root=1-583de0ba-d26be22c375ed3416b2e18b7 X-Cache: Miss from cloudfront Via: 1.1 6ba12aeff47e3e7677e084594bfce5e1.cloudfront.net (CloudFront) X-Amz-Cf-Id: QoWCvISTvYBbaP2hAoxC8_TWTl2JN-kNASYCjCJ5HztN0e1OuzvpSA== { "jobName": "example", "jobId": "876da822-4198-45f2-a252-6cea32512ea8" }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: