Skip to content

Resource: awsBatchJobQueue

Provides a Batch Job Queue resource.

Example Usage

Basic Job Queue

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.batchJobQueue.BatchJobQueue(this, "test_queue", {
  computeEnvironments: [
    "${aws_batch_compute_environment.test_environment_1.arn}",
    "${aws_batch_compute_environment.test_environment_2.arn}",
  ],
  name: "tf-test-batch-job-queue",
  priority: 1,
  state: "ENABLED",
});

Job Queue with a fair share scheduling policy

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsBatchSchedulingPolicyExample =
  new aws.batchSchedulingPolicy.BatchSchedulingPolicy(this, "example", {
    fairSharePolicy: {
      computeReservation: 1,
      shareDecaySeconds: 3600,
      shareDistribution: [
        {
          shareIdentifier: "A1*",
          weightFactor: 0.1,
        },
      ],
    },
    name: "example",
  });
const awsBatchJobQueueExample = new aws.batchJobQueue.BatchJobQueue(
  this,
  "example_1",
  {
    computeEnvironments: [
      "${aws_batch_compute_environment.test_environment_1.arn}",
      "${aws_batch_compute_environment.test_environment_2.arn}",
    ],
    name: "tf-test-batch-job-queue",
    priority: 1,
    schedulingPolicyArn: awsBatchSchedulingPolicyExample.arn,
    state: "ENABLED",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsBatchJobQueueExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the job queue.
  • computeEnvironments - (Required) Specifies the set of compute environments mapped to a job queue and their order. The position of the compute environments in the list will dictate the order.
  • priority - (Required) The priority of the job queue. Job queues with a higher priority are evaluated first when associated with the same compute environment.
  • schedulingPolicyArn - (Optional) The ARN of the fair share scheduling policy. If this parameter is specified, the job queue uses a fair share scheduling policy. If this parameter isn't specified, the job queue uses a first in, first out (FIFO) scheduling policy. After a job queue is created, you can replace but can't remove the fair share scheduling policy.
  • state - (Required) The state of the job queue. Must be one of: enabled or disabled
  • tags - (Optional) Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - The Amazon Resource Name of the job queue.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

Batch Job Queue can be imported using the arn, e.g.,

$ terraform import aws_batch_job_queue.test_queue arn:aws:batch:us-east-1:123456789012:job-queue/sample