Skip to content
GitHubXDiscord

JobQueue

The JobQueue resource allows you to manage AWS Batch JobQueues which are used for submitting and managing jobs in AWS Batch.

Create a basic JobQueue with the required properties and one optional property.

import AWS from "alchemy/aws/control";
const jobQueue = await AWS.Batch.JobQueue("primary-job-queue", {
ComputeEnvironmentOrder: [
{
ComputeEnvironment: "my-compute-environment",
Order: 1
}
],
Priority: 1,
JobQueueName: "PrimaryJobQueue"
});

Configure a JobQueue with a specific scheduling policy and state.

const advancedJobQueue = await AWS.Batch.JobQueue("advanced-job-queue", {
ComputeEnvironmentOrder: [
{
ComputeEnvironment: "my-compute-environment",
Order: 1
},
{
ComputeEnvironment: "my-secondary-compute-environment",
Order: 2
}
],
Priority: 10,
State: "ENABLED",
SchedulingPolicyArn: "arn:aws:batch:us-west-2:123456789012:scheduling-policy/my-scheduling-policy"
});

Create a JobQueue with job state time limit actions to manage jobs that exceed time limits.

const jobStateLimitQueue = await AWS.Batch.JobQueue("job-state-limit-queue", {
ComputeEnvironmentOrder: [
{
ComputeEnvironment: "my-compute-environment",
Order: 1
}
],
Priority: 5,
JobStateTimeLimitActions: [
{
Action: "CANCEL",
Timeout: 3600 // Cancel jobs that exceed 1 hour
}
],
JobQueueName: "JobStateLimitQueue"
});