

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::Batch::JobQueue
<a name="aws-resource-batch-jobqueue"></a>

The `AWS::Batch::JobQueue` resource specifies the parameters for an AWS Batch job queue definition. For more information, see [Job Queues](https://docs.aws.amazon.com/batch/latest/userguide/job_queues.html) in the * AWS Batch User Guide *.

## Syntax
<a name="aws-resource-batch-jobqueue-syntax"></a>

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

### JSON
<a name="aws-resource-batch-jobqueue-syntax.json"></a>

```
{
  "Type" : "AWS::Batch::JobQueue",
  "Properties" : {
      "[ComputeEnvironmentOrder](#cfn-batch-jobqueue-computeenvironmentorder)" : [ ComputeEnvironmentOrder, ... ],
      "[JobQueueName](#cfn-batch-jobqueue-jobqueuename)" : String,
      "[JobQueueType](#cfn-batch-jobqueue-jobqueuetype)" : String,
      "[JobStateTimeLimitActions](#cfn-batch-jobqueue-jobstatetimelimitactions)" : [ JobStateTimeLimitAction, ... ],
      "[Priority](#cfn-batch-jobqueue-priority)" : Integer,
      "[SchedulingPolicyArn](#cfn-batch-jobqueue-schedulingpolicyarn)" : String,
      "[ServiceEnvironmentOrder](#cfn-batch-jobqueue-serviceenvironmentorder)" : [ ServiceEnvironmentOrder, ... ],
      "[State](#cfn-batch-jobqueue-state)" : String,
      "[Tags](#cfn-batch-jobqueue-tags)" : {Key: Value, ...}
    }
}
```

### YAML
<a name="aws-resource-batch-jobqueue-syntax.yaml"></a>

```
Type: AWS::Batch::JobQueue
Properties:
  [ComputeEnvironmentOrder](#cfn-batch-jobqueue-computeenvironmentorder): 
    - ComputeEnvironmentOrder
  [JobQueueName](#cfn-batch-jobqueue-jobqueuename): String
  [JobQueueType](#cfn-batch-jobqueue-jobqueuetype): String
  [JobStateTimeLimitActions](#cfn-batch-jobqueue-jobstatetimelimitactions): 
    - JobStateTimeLimitAction
  [Priority](#cfn-batch-jobqueue-priority): Integer
  [SchedulingPolicyArn](#cfn-batch-jobqueue-schedulingpolicyarn): String
  [ServiceEnvironmentOrder](#cfn-batch-jobqueue-serviceenvironmentorder): 
    - ServiceEnvironmentOrder
  [State](#cfn-batch-jobqueue-state): String
  [Tags](#cfn-batch-jobqueue-tags): 
    Key: Value
```

## Properties
<a name="aws-resource-batch-jobqueue-properties"></a>

`ComputeEnvironmentOrder`  <a name="cfn-batch-jobqueue-computeenvironmentorder"></a>
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.  
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*: No  
*Type*: [Array](aws-properties-batch-jobqueue-computeenvironmentorder.md) of [ComputeEnvironmentOrder](aws-properties-batch-jobqueue-computeenvironmentorder.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`JobQueueName`  <a name="cfn-batch-jobqueue-jobqueuename"></a>
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 (\$1).  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`JobQueueType`  <a name="cfn-batch-jobqueue-jobqueuetype"></a>
The type of job queue. For service jobs that run on SageMaker AI, this value is `SAGEMAKER_TRAINING`. For regular container jobs, this value is `EKS`, `ECS`, or `ECS_FARGATE` depending on the compute environment.  
*Required*: No  
*Type*: String  
*Allowed values*: `EKS | ECS | ECS_FARGATE | SAGEMAKER_TRAINING`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`JobStateTimeLimitActions`  <a name="cfn-batch-jobqueue-jobstatetimelimitactions"></a>
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](aws-properties-batch-jobqueue-jobstatetimelimitaction.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Priority`  <a name="cfn-batch-jobqueue-priority"></a>
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](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`SchedulingPolicyArn`  <a name="cfn-batch-jobqueue-schedulingpolicyarn"></a>
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](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ServiceEnvironmentOrder`  <a name="cfn-batch-jobqueue-serviceenvironmentorder"></a>
The order of the service environment associated with the job queue. Job queues with a higher priority are evaluated first when associated with the same service environment.  
*Required*: No  
*Type*: [Array](aws-properties-batch-jobqueue-serviceenvironmentorder.md) of [ServiceEnvironmentOrder](aws-properties-batch-jobqueue-serviceenvironmentorder.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`State`  <a name="cfn-batch-jobqueue-state"></a>
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](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Tags`  <a name="cfn-batch-jobqueue-tags"></a>
The tags that are applied to the job queue. For more information, see [Tagging your AWS Batch resources](https://docs.aws.amazon.com/batch/latest/userguide/using-tags.html) in *AWS Batch User Guide*.  
*Required*: No  
*Type*: Object of String  
*Pattern*: `.*`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return values
<a name="aws-resource-batch-jobqueue-return-values"></a>

### Ref
<a name="aws-resource-batch-jobqueue-return-values-ref"></a>

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 [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-batch-jobqueue-return-values-fn--getatt"></a>

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 [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html).

#### 
<a name="aws-resource-batch-jobqueue-return-values-fn--getatt-fn--getatt"></a>

`JobQueueArn`  <a name="JobQueueArn-fn::getatt"></a>
Returns the job queue ARN, such as `arn:aws:batch:us-east-1:111122223333:job-queue/JobQueueName`.

## Examples
<a name="aws-resource-batch-jobqueue--examples"></a>



### Job queue with two compute environments
<a name="aws-resource-batch-jobqueue--examples--Job_queue_with_two_compute_environments"></a>

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

#### JSON
<a name="aws-resource-batch-jobqueue--examples--Job_queue_with_two_compute_environments--json"></a>

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

#### YAML
<a name="aws-resource-batch-jobqueue--examples--Job_queue_with_two_compute_environments--yaml"></a>

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

## See also
<a name="aws-resource-batch-jobqueue--seealso"></a>
+ [Job Queue Parameters](https://docs.aws.amazon.com/batch/latest/userguide/job_queue_parameters.html) in the * AWS Batch User Guide *.

# AWS::Batch::JobQueue ComputeEnvironmentOrder
<a name="aws-properties-batch-jobqueue-computeenvironmentorder"></a>

The order that compute environments are tried in for job placement within a queue. Compute environments are tried in ascending order. For example, if two compute environments are associated with a job queue, the compute environment with a lower order integer value is tried for job placement first. Compute environments must be in the `VALID` state before you can associate them with a job queue. All of the compute environments must be either EC2 (`EC2` or `SPOT`) or Fargate (`FARGATE` or `FARGATE_SPOT`); Amazon 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.

## Syntax
<a name="aws-properties-batch-jobqueue-computeenvironmentorder-syntax"></a>

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

### JSON
<a name="aws-properties-batch-jobqueue-computeenvironmentorder-syntax.json"></a>

```
{
  "[ComputeEnvironment](#cfn-batch-jobqueue-computeenvironmentorder-computeenvironment)" : String,
  "[Order](#cfn-batch-jobqueue-computeenvironmentorder-order)" : Integer
}
```

### YAML
<a name="aws-properties-batch-jobqueue-computeenvironmentorder-syntax.yaml"></a>

```
  [ComputeEnvironment](#cfn-batch-jobqueue-computeenvironmentorder-computeenvironment): String
  [Order](#cfn-batch-jobqueue-computeenvironmentorder-order): Integer
```

## Properties
<a name="aws-properties-batch-jobqueue-computeenvironmentorder-properties"></a>

`ComputeEnvironment`  <a name="cfn-batch-jobqueue-computeenvironmentorder-computeenvironment"></a>
The Amazon Resource Name (ARN) of the compute environment.  
*Required*: Yes  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Order`  <a name="cfn-batch-jobqueue-computeenvironmentorder-order"></a>
The order of the compute environment. Compute environments are tried in ascending order. For example, if two compute environments are associated with a job queue, the compute environment with a lower `order` integer value is tried for job placement first.  
*Required*: Yes  
*Type*: Integer  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::Batch::JobQueue JobStateTimeLimitAction
<a name="aws-properties-batch-jobqueue-jobstatetimelimitaction"></a>

Specifies an action that AWS Batch will take after the job has remained at the head of the queue in the specified state for longer than the specified time.

## Syntax
<a name="aws-properties-batch-jobqueue-jobstatetimelimitaction-syntax"></a>

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

### JSON
<a name="aws-properties-batch-jobqueue-jobstatetimelimitaction-syntax.json"></a>

```
{
  "[Action](#cfn-batch-jobqueue-jobstatetimelimitaction-action)" : String,
  "[MaxTimeSeconds](#cfn-batch-jobqueue-jobstatetimelimitaction-maxtimeseconds)" : Integer,
  "[Reason](#cfn-batch-jobqueue-jobstatetimelimitaction-reason)" : String,
  "[State](#cfn-batch-jobqueue-jobstatetimelimitaction-state)" : String
}
```

### YAML
<a name="aws-properties-batch-jobqueue-jobstatetimelimitaction-syntax.yaml"></a>

```
  [Action](#cfn-batch-jobqueue-jobstatetimelimitaction-action): String
  [MaxTimeSeconds](#cfn-batch-jobqueue-jobstatetimelimitaction-maxtimeseconds): Integer
  [Reason](#cfn-batch-jobqueue-jobstatetimelimitaction-reason): String
  [State](#cfn-batch-jobqueue-jobstatetimelimitaction-state): String
```

## Properties
<a name="aws-properties-batch-jobqueue-jobstatetimelimitaction-properties"></a>

`Action`  <a name="cfn-batch-jobqueue-jobstatetimelimitaction-action"></a>
The action to take when a job is at the head of the job queue in the specified state for the specified period of time. For job queues connected to a `ECS`, `FARGATE` or `EKS` compute environment, the only supported value is `CANCEL`, which will cancel the job. For job queues connected to a `SAGEMAKER_TRAINING` service environment, the only supported value is `TERMINATE`, which will terminate the job.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `CANCEL | TERMINATE`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`MaxTimeSeconds`  <a name="cfn-batch-jobqueue-jobstatetimelimitaction-maxtimeseconds"></a>
The approximate amount of time, in seconds, that must pass with the job in the specified state before the action is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).  
*Required*: Yes  
*Type*: Integer  
*Minimum*: `600`  
*Maximum*: `86400`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Reason`  <a name="cfn-batch-jobqueue-jobstatetimelimitaction-reason"></a>
The reason to log for the action being taken.  
*Required*: Yes  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`State`  <a name="cfn-batch-jobqueue-jobstatetimelimitaction-state"></a>
The state of the job needed to trigger the action. The only supported value is `RUNNABLE`.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `RUNNABLE`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::Batch::JobQueue ServiceEnvironmentOrder
<a name="aws-properties-batch-jobqueue-serviceenvironmentorder"></a>

Specifies the order of a service environment for a job queue. This determines the priority order when multiple service environments are associated with the same job queue.

## Syntax
<a name="aws-properties-batch-jobqueue-serviceenvironmentorder-syntax"></a>

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

### JSON
<a name="aws-properties-batch-jobqueue-serviceenvironmentorder-syntax.json"></a>

```
{
  "[Order](#cfn-batch-jobqueue-serviceenvironmentorder-order)" : Integer,
  "[ServiceEnvironment](#cfn-batch-jobqueue-serviceenvironmentorder-serviceenvironment)" : String
}
```

### YAML
<a name="aws-properties-batch-jobqueue-serviceenvironmentorder-syntax.yaml"></a>

```
  [Order](#cfn-batch-jobqueue-serviceenvironmentorder-order): Integer
  [ServiceEnvironment](#cfn-batch-jobqueue-serviceenvironmentorder-serviceenvironment): String
```

## Properties
<a name="aws-properties-batch-jobqueue-serviceenvironmentorder-properties"></a>

`Order`  <a name="cfn-batch-jobqueue-serviceenvironmentorder-order"></a>
The order of the service environment. Job queues with a higher priority are evaluated first when associated with the same service environment.  
*Required*: Yes  
*Type*: Integer  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ServiceEnvironment`  <a name="cfn-batch-jobqueue-serviceenvironmentorder-serviceenvironment"></a>
The name or ARN of the service environment.  
*Required*: Yes  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)