AWS::Batch::JobQueue - AWS CloudFormation

AWS::Batch::JobQueue

The AWS::Batch::JobQueue resource specifies the parameters for an AWS Batch job queue definition. For more information, see Job Queues in the AWS Batch User Guide .

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::Batch::JobQueue", "Properties" : { "ComputeEnvironmentOrder" : [ ComputeEnvironmentOrder, ... ], "JobQueueName" : String, "JobStateTimeLimitActions" : [ JobStateTimeLimitAction, ... ], "Priority" : Integer, "SchedulingPolicyArn" : String, "State" : String, "Tags" : {Key: Value, ...} } }

YAML

Type: AWS::Batch::JobQueue Properties: ComputeEnvironmentOrder: - ComputeEnvironmentOrder JobQueueName: String JobStateTimeLimitActions: - JobStateTimeLimitAction Priority: Integer SchedulingPolicyArn: String State: String Tags: Key: Value

Properties

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 runs 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. AWS Batch doesn't support mixing compute environment architecture types in a single job queue.

Required: Yes

Type: Array of ComputeEnvironmentOrder

Update requires: No interruption

JobQueueName

The name of the job queue. It can be up to 128 letters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).

Required: No

Type: String

Minimum: 1

Maximum: 128

Update requires: Replacement

JobStateTimeLimitActions

The set of actions that AWS Batch perform on jobs that remain at the head of the job queue in the specified state longer than specified times. AWS Batch will perform each action after maxTimeSeconds has passed.

Required: No

Type: Array of JobStateTimeLimitAction

Update requires: No interruption

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.

Required: Yes

Type: Integer

Minimum: 0

Maximum: 1000

Update requires: No interruption

SchedulingPolicyArn

The Amazon Resource Name (ARN) of the scheduling policy. The format is aws:Partition:batch:Region:Account:scheduling-policy/Name . For example, aws:aws:batch:us-west-2:123456789012:scheduling-policy/MySchedulingPolicy.

Required: No

Type: String

Pattern: arn:[a-z0-9-\.]{1,63}:[a-z0-9-\.]{0,63}:[a-z0-9-\.]{0,63}:[a-z0-9-\.]{0,63}:[^/].{0,1023}

Update requires: No interruption

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.

Required: No

Type: String

Allowed values: DISABLED | ENABLED

Update requires: No interruption

Tags

The tags that are applied to the job queue. For more information, see Tagging your AWS Batch resources in AWS Batch User Guide.

Required: No

Type: Object of String

Pattern: .*

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the job queue ARN, such as arn:aws:batch:us-east-1:111122223333:job-queue/HighPriority .

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

JobQueueArn

Returns the job queue ARN, such as arn:aws:batch:us-east-1:111122223333:job-queue/JobQueueName .

Examples

Job queue with two compute environments

The following example defines a job queue called HighPriority that has two compute environments mapped to it.

JSON

{ "JobQueue": { "Type": "AWS::Batch::JobQueue", "Properties": { "ComputeEnvironmentOrder": [ { "Order": 1, "ComputeEnvironment": "C4OnDemand" }, { "Order": 2, "ComputeEnvironment": "M4Spot" } ], "State": "ENABLED", "Priority": 1, "JobQueueName": "HighPriority" } } }

YAML

JobQueue: Type: 'AWS::Batch::JobQueue' Properties: ComputeEnvironmentOrder: - Order: 1 ComputeEnvironment: C4OnDemand - Order: 2 ComputeEnvironment: M4Spot State: ENABLED Priority: 1 JobQueueName: HighPriority

See also