JobQueue class

Provides a Batch Job Queue resource.

Example Usage

Basic Job Queue

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const testQueue = new aws.batch.JobQueue("test_queue", {
    computeEnvironmentOrders: [
        {
            order: 1,
            computeEnvironment: testEnvironment1.arn,
        },
        {
            order: 2,
            computeEnvironment: testEnvironment2.arn,
        },
    ],
    name: "tf-test-batch-job-queue",
    state: "ENABLED",
    priority: 1,
});
import pulumi
import pulumi_aws as aws

test_queue = aws.batch.JobQueue("test_queue",
    compute_environment_orders=[
        {
            "order": 1,
            "compute_environment": test_environment1["arn"],
        },
        {
            "order": 2,
            "compute_environment": test_environment2["arn"],
        },
    ],
    name="tf-test-batch-job-queue",
    state="ENABLED",
    priority=1)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var testQueue = new Aws.Batch.JobQueue("test_queue", new()
    {
        ComputeEnvironmentOrders = new[]
        {
            new Aws.Batch.Inputs.JobQueueComputeEnvironmentOrderArgs
            {
                Order = 1,
                ComputeEnvironment = testEnvironment1.Arn,
            },
            new Aws.Batch.Inputs.JobQueueComputeEnvironmentOrderArgs
            {
                Order = 2,
                ComputeEnvironment = testEnvironment2.Arn,
            },
        },
        Name = "tf-test-batch-job-queue",
        State = "ENABLED",
        Priority = 1,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/batch"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := batch.NewJobQueue(ctx, "test_queue", &batch.JobQueueArgs{
			ComputeEnvironmentOrders: batch.JobQueueComputeEnvironmentOrderArray{
				&batch.JobQueueComputeEnvironmentOrderArgs{
					Order:              pulumi.Int(1),
					ComputeEnvironment: pulumi.Any(testEnvironment1.Arn),
				},
				&batch.JobQueueComputeEnvironmentOrderArgs{
					Order:              pulumi.Int(2),
					ComputeEnvironment: pulumi.Any(testEnvironment2.Arn),
				},
			},
			Name:     pulumi.String("tf-test-batch-job-queue"),
			State:    pulumi.String("ENABLED"),
			Priority: pulumi.Int(1),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_batch_jobqueue" "test_queue" {
  compute_environment_orders {
    order               = 1
    compute_environment = testEnvironment1.arn
  }
  compute_environment_orders {
    order               = 2
    compute_environment = testEnvironment2.arn
  }
  name     = "tf-test-batch-job-queue"
  state    = "ENABLED"
  priority = 1
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.batch.JobQueue;
import com.pulumi.aws.batch.JobQueueArgs;
import com.pulumi.aws.batch.inputs.JobQueueComputeEnvironmentOrderArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var testQueue = new JobQueue("testQueue", JobQueueArgs.builder()
            .computeEnvironmentOrders(
                JobQueueComputeEnvironmentOrderArgs.builder()
                    .order(1)
                    .computeEnvironment(testEnvironment1.arn())
                    .build(),
                JobQueueComputeEnvironmentOrderArgs.builder()
                    .order(2)
                    .computeEnvironment(testEnvironment2.arn())
                    .build())
            .name("tf-test-batch-job-queue")
            .state("ENABLED")
            .priority(1)
            .build());

    }
}
resources:
  testQueue:
    type: aws:batch:JobQueue
    name: test_queue
    properties:
      computeEnvironmentOrders:
        - order: 1
          computeEnvironment: ${testEnvironment1.arn}
        - order: 2
          computeEnvironment: ${testEnvironment2.arn}
      name: tf-test-batch-job-queue
      state: ENABLED
      priority: 1

Job Queue with a fair share scheduling policy

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.batch.SchedulingPolicy("example", {
    fairSharePolicy: {
        shareDistributions: [{
            shareIdentifier: "A1*",
            weightFactor: 0.1,
        }],
        computeReservation: 1,
        shareDecaySeconds: 3600,
    },
    name: "example",
});
const exampleJobQueue = new aws.batch.JobQueue("example", {
    computeEnvironmentOrders: [
        {
            order: 1,
            computeEnvironment: testEnvironment1.arn,
        },
        {
            order: 2,
            computeEnvironment: testEnvironment2.arn,
        },
    ],
    name: "tf-test-batch-job-queue",
    schedulingPolicyArn: example.arn,
    state: "ENABLED",
    priority: 1,
});
import pulumi
import pulumi_aws as aws

example = aws.batch.SchedulingPolicy("example",
    fair_share_policy={
        "share_distributions": [{
            "share_identifier": "A1*",
            "weight_factor": 0.1,
        }],
        "compute_reservation": 1,
        "share_decay_seconds": 3600,
    },
    name="example")
example_job_queue = aws.batch.JobQueue("example",
    compute_environment_orders=[
        {
            "order": 1,
            "compute_environment": test_environment1["arn"],
        },
        {
            "order": 2,
            "compute_environment": test_environment2["arn"],
        },
    ],
    name="tf-test-batch-job-queue",
    scheduling_policy_arn=example.arn,
    state="ENABLED",
    priority=1)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Batch.SchedulingPolicy("example", new()
    {
        FairSharePolicy = new Aws.Batch.Inputs.SchedulingPolicyFairSharePolicyArgs
        {
            ShareDistributions = new[]
            {
                new Aws.Batch.Inputs.SchedulingPolicyFairSharePolicyShareDistributionArgs
                {
                    ShareIdentifier = "A1*",
                    WeightFactor = 0.1,
                },
            },
            ComputeReservation = 1,
            ShareDecaySeconds = 3600,
        },
        Name = "example",
    });

    var exampleJobQueue = new Aws.Batch.JobQueue("example", new()
    {
        ComputeEnvironmentOrders = new[]
        {
            new Aws.Batch.Inputs.JobQueueComputeEnvironmentOrderArgs
            {
                Order = 1,
                ComputeEnvironment = testEnvironment1.Arn,
            },
            new Aws.Batch.Inputs.JobQueueComputeEnvironmentOrderArgs
            {
                Order = 2,
                ComputeEnvironment = testEnvironment2.Arn,
            },
        },
        Name = "tf-test-batch-job-queue",
        SchedulingPolicyArn = example.Arn,
        State = "ENABLED",
        Priority = 1,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/batch"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := batch.NewSchedulingPolicy(ctx, "example", &batch.SchedulingPolicyArgs{
			FairSharePolicy: &batch.SchedulingPolicyFairSharePolicyArgs{
				ShareDistributions: batch.SchedulingPolicyFairSharePolicyShareDistributionArray{
					&batch.SchedulingPolicyFairSharePolicyShareDistributionArgs{
						ShareIdentifier: pulumi.String("A1*"),
						WeightFactor:    pulumi.Float64(0.1),
					},
				},
				ComputeReservation: pulumi.Int(1),
				ShareDecaySeconds:  pulumi.Int(3600),
			},
			Name: pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		_, err = batch.NewJobQueue(ctx, "example", &batch.JobQueueArgs{
			ComputeEnvironmentOrders: batch.JobQueueComputeEnvironmentOrderArray{
				&batch.JobQueueComputeEnvironmentOrderArgs{
					Order:              pulumi.Int(1),
					ComputeEnvironment: pulumi.Any(testEnvironment1.Arn),
				},
				&batch.JobQueueComputeEnvironmentOrderArgs{
					Order:              pulumi.Int(2),
					ComputeEnvironment: pulumi.Any(testEnvironment2.Arn),
				},
			},
			Name:                pulumi.String("tf-test-batch-job-queue"),
			SchedulingPolicyArn: example.Arn,
			State:               pulumi.String("ENABLED"),
			Priority:            pulumi.Int(1),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_batch_schedulingpolicy" "example" {
  fair_share_policy = {
    share_distributions = [{
      "shareIdentifier" = "A1*"
      "weightFactor"    = 0.1
    }]
    compute_reservation = 1
    share_decay_seconds = 3600
  }
  name = "example"
}
resource "aws_batch_jobqueue" "example" {
  compute_environment_orders {
    order               = 1
    compute_environment = testEnvironment1.arn
  }
  compute_environment_orders {
    order               = 2
    compute_environment = testEnvironment2.arn
  }
  name                  = "tf-test-batch-job-queue"
  scheduling_policy_arn = aws_batch_schedulingpolicy.example.arn
  state                 = "ENABLED"
  priority              = 1
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.batch.SchedulingPolicy;
import com.pulumi.aws.batch.SchedulingPolicyArgs;
import com.pulumi.aws.batch.inputs.SchedulingPolicyFairSharePolicyArgs;
import com.pulumi.aws.batch.inputs.SchedulingPolicyFairSharePolicyShareDistributionArgs;
import com.pulumi.aws.batch.JobQueue;
import com.pulumi.aws.batch.JobQueueArgs;
import com.pulumi.aws.batch.inputs.JobQueueComputeEnvironmentOrderArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new SchedulingPolicy("example", SchedulingPolicyArgs.builder()
            .fairSharePolicy(SchedulingPolicyFairSharePolicyArgs.builder()
                .shareDistributions(SchedulingPolicyFairSharePolicyShareDistributionArgs.builder()
                    .shareIdentifier("A1*")
                    .weightFactor(0.1)
                    .build())
                .computeReservation(1)
                .shareDecaySeconds(3600)
                .build())
            .name("example")
            .build());

        var exampleJobQueue = new JobQueue("exampleJobQueue", JobQueueArgs.builder()
            .computeEnvironmentOrders(
                JobQueueComputeEnvironmentOrderArgs.builder()
                    .order(1)
                    .computeEnvironment(testEnvironment1.arn())
                    .build(),
                JobQueueComputeEnvironmentOrderArgs.builder()
                    .order(2)
                    .computeEnvironment(testEnvironment2.arn())
                    .build())
            .name("tf-test-batch-job-queue")
            .schedulingPolicyArn(example.arn())
            .state("ENABLED")
            .priority(1)
            .build());

    }
}
resources:
  example:
    type: aws:batch:SchedulingPolicy
    properties:
      fairSharePolicy:
        shareDistributions:
          - shareIdentifier: A1*
            weightFactor: 0.1
        computeReservation: 1
        shareDecaySeconds: 3600
      name: example
  exampleJobQueue:
    type: aws:batch:JobQueue
    name: example
    properties:
      computeEnvironmentOrders:
        - order: 1
          computeEnvironment: ${testEnvironment1.arn}
        - order: 2
          computeEnvironment: ${testEnvironment2.arn}
      name: tf-test-batch-job-queue
      schedulingPolicyArn: ${example.arn}
      state: ENABLED
      priority: 1

Import

Identity Schema

Required

  • arn (String) ARN of the job queue.

Using pulumi import, import Batch Job Queue using the arn. For example:

$ pulumi import aws:batch/jobQueue:JobQueue test_queue arn:aws:batch:us-east-1:123456789012:job-queue/sample

Constructors

JobQueue(String name, {JobQueueArgs? args, CustomResourceOptions? options})
Creates a new JobQueue. name The Pulumi resource name. args Arguments used to configure this JobQueue. The set of arguments for JobQueue. options Resource options controlling this resource's behavior.
JobQueue.reference(String urn)
Creates a typed reference to an existing JobQueue resource.

Properties

arn ↔ Output<String>
ARN of the job queue.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
computeEnvironmentOrders ↔ Output<List<JobQueueComputeEnvironmentOrder>?>
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.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
jobStateTimeLimitActions ↔ Output<List<JobQueueJobStateTimeLimitAction>?>
The set of job state time limit actions mapped to a job queue. 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.
latefinal
name ↔ Output<String>
Specifies the name of the job queue.
latefinal
priority ↔ Output<int>
The priority of the job queue. Job queues with a higher priority are evaluated first when associated with the same compute environment.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schedulingPolicyArn ↔ Output<String?>
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.
latefinal
state ↔ Output<String>
The state of the job queue. Must be one of: ENABLED or DISABLED
latefinal
tags ↔ Output<Map<String, String>?>
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.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
timeouts ↔ Output<JobQueueTimeouts?>
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {JobQueueState? state, CustomResourceOptions? options}) → JobQueue
Gets an existing JobQueue resource's state with the given name and id.