CreateJobQueue - 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.

CreateJobQueue

Creates an Amazon Batch job queue. When you create a job queue, you associate one or more compute environments to the queue and assign an order of preference for the compute environments.

You also set a priority to the job queue that determines the order that the Amazon Batch scheduler places jobs onto its associated compute environments. For example, if a compute environment is associated with more than one job queue, the job queue with a higher priority is given preference for scheduling jobs to that compute environment.

Request Syntax

POST /v1/createjobqueue HTTP/1.1 Content-type: application/json { "computeEnvironmentOrder": [ { "computeEnvironment": "string", "order": number } ], "jobQueueName": "string", "priority": number, "state": "string", "tags": { "string" : "string" } }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

computeEnvironmentOrder

The set of compute environments mapped to a job queue and their order relative to each other. The job scheduler uses this parameter to determine which compute environment should run a specific job. Compute environments must be in the VALID state before you can associate them with a job queue. You can associate up to three compute environments with a job queue. All of the compute environments must be either EC2 (EC2 or SPOT) or Fargate (FARGATE or FARGATE_SPOT); EC2 and Fargate compute environments can't be mixed.

Note

All compute environments that are associated with a job queue must share the same architecture. Amazon Batch doesn't support mixing compute environment architecture types in a single job queue.

Type: Array of ComputeEnvironmentOrder objects

Required: Yes

jobQueueName

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

Type: String

Required: Yes

priority

The priority of the job queue. Job queues with a higher priority (or a higher integer value for the priority parameter) are evaluated first when associated with the same compute environment. Priority is determined in descending order. For example, a job queue with a priority value of 10 is given scheduling preference over a job queue with a priority value of 1. All of the compute environments must be either EC2 (EC2 or SPOT) or Fargate (FARGATE or FARGATE_SPOT); EC2 and Fargate compute environments can't be mixed.

Type: Integer

Required: Yes

state

The state of the job queue. If the job queue state is ENABLED, it is able to accept jobs. If the job queue state is DISABLED, new jobs can't be added to the queue, but jobs already in the queue can finish.

Type: String

Valid Values: ENABLED | DISABLED

Required: No

tags

The tags that you apply to the job queue to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see Tagging your Amazon Batch resources in Amazon Batch User Guide.

Type: String to string map

Map Entries: Maximum number of 50 items.

Key Length Constraints: Minimum length of 1. Maximum length of 128.

Value Length Constraints: Maximum length of 256.

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "jobQueueArn": "string", "jobQueueName": "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.

jobQueueArn

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

Type: String

jobQueueName

The name of the job queue.

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 permissions to use the action or resource, or specifying an identifier that's not valid.

HTTP Status Code: 400

ServerException

These errors are usually caused by a server issue.

HTTP Status Code: 500

Examples

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

You only need to learn how to sign HTTP requests if you intend to manually create them. When you use the Amazon Command Line Interface (Amazon CLI) or one of the Amazon SDKs to make requests to Amazon, 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 creates a job queue called LowPriority that uses the M4Spot compute environment.

Sample Request

POST /v1/createjobqueue HTTP/1.1 Host: batch.us-east-1.amazonaws.com Accept-Encoding: identity Content-Length: 142 Authorization: AUTHPARAMS X-Amz-Date: 20161128T234201Z User-Agent: aws-cli/1.11.21 Python/2.7.12 Darwin/16.1.0 botocore/1.4.78 { "priority": 1, "state": "ENABLED", "computeEnvironmentOrder": [ { "computeEnvironment": "M4Spot", "order": 1 } ], "jobQueueName": "LowPriority" }

Sample Response

HTTP/1.1 200 OK Content-Type: application/json Content-Length: 105 Connection: keep-alive Date: Mon, 28 Nov 2016 23:42:02 GMT x-amzn-RequestId: 42a92eee-b5c4-11e6-b15b-8167bcebef9d X-Amzn-Trace-Id: Root=1-583cc0c9-f47ba831b55e794291697c39 X-Cache: Miss from cloudfront Via: 1.1 a44b4468444ef3ee67472bd5c5016098.cloudfront.net (CloudFront) X-Amz-Cf-Id: bz9IuCM5FNkDfge5y-Zw7nFEjDdTHDYFwbEY2AKUqrt9l2XeKUcuyA== { "jobQueueName": "LowPriority", "jobQueueArn": "arn:aws:batch:us-east-1:012345678910:job-queue/LowPriority" }

Example

This example creates a job queue called HighPriority that uses the C4OnDemand compute environment with an order of 1 and the M4Spot compute environment with an order of 2.

Sample Request

POST /v1/createjobqueue HTTP/1.1 Host: batch.us-east-1.amazonaws.com Accept-Encoding: identity Content-Length: 192 Authorization: AUTHPARAMS X-Amz-Date: 20161128T234933Z User-Agent: aws-cli/1.11.21 Python/2.7.12 Darwin/16.1.0 botocore/1.4.78 { "priority": 10, "state": "ENABLED", "computeEnvironmentOrder": [ { "computeEnvironment": "C4OnDemand", "order": 1 }, { "computeEnvironment": "M4Spot", "order": 2 } ], "jobQueueName": "HighPriority" }

Sample Response

HTTP/1.1 200 OK Date: Mon, 28 Nov 2016 23:49:34 GMT Content-Type: application/json Content-Length: 107 Connection: keep-alive x-amzn-RequestId: 503cdf30-b5c5-11e6-b7a0-a325cf93a1c0 X-Amzn-Trace-Id: Root=1-583cc28e-ca43f4d9fb8dc73ebb99dd67 X-Cache: Miss from cloudfront Via: 1.1 e81bbcbc86832b655de5b9a19317ad01.cloudfront.net (CloudFront) X-Amz-Cf-Id: 8NB20odDPMaKy9zHa6GPaGN_r562QsynDTRYPuhKwHSvQrMG70IHSQ== { "jobQueueName": "HighPriority", "jobQueueArn": "arn:aws:batch:us-east-1:012345678910:job-queue/HighPriority" }