Module batch
This page documents the language specification for the aws package. If you're looking for help working with the inputs, outputs, or functions of aws resources in a Pulumi program, please see the resource documentation for examples and API reference.
This provider is a derived work of the Terraform Provider distributed under MPL 2.0. If you encounter a bug or missing feature, first check the
pulumi/pulumi-awsrepo; however, if that doesn’t turn up anything, please consult the sourceterraform-providers/terraform-provider-awsrepo.
Resources
Functions
Others
- ComputeEnvironmentArgs
- ComputeEnvironmentState
- GetComputeEnvironmentArgs
- GetComputeEnvironmentResult
- GetJobQueueArgs
- GetJobQueueResult
- JobDefinitionArgs
- JobDefinitionState
- JobQueueArgs
- JobQueueState
Resources
Resource ComputeEnvironment
class ComputeEnvironment extends CustomResourceCreates a AWS Batch compute environment. Compute environments contain the Amazon ECS container instances that are used to run containerized batch jobs.
For information about AWS Batch, see What is AWS Batch? . For information about compute environment, see Compute Environments .
Note: To prevent a race condition during environment deletion, make sure to set
dependsOnto the relatedaws.iam.RolePolicyAttachment; otherwise, the policy may be destroyed too soon and the compute environment will then get stuck in theDELETINGstate, see Troubleshooting AWS Batch .
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ecsInstanceRoleRole = new aws.iam.Role("ecs_instance_role", {
assumeRolePolicy: `{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
}
}
]
}
`,
});
const ecsInstanceRoleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("ecs_instance_role", {
policyArn: "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role",
role: ecsInstanceRoleRole.name,
});
const ecsInstanceRoleInstanceProfile = new aws.iam.InstanceProfile("ecs_instance_role", {
role: ecsInstanceRoleRole.name,
});
const awsBatchServiceRoleRole = new aws.iam.Role("aws_batch_service_role", {
assumeRolePolicy: `{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "batch.amazonaws.com"
}
}
]
}
`,
});
const awsBatchServiceRoleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("aws_batch_service_role", {
policyArn: "arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole",
role: awsBatchServiceRoleRole.name,
});
const sampleSecurityGroup = new aws.ec2.SecurityGroup("sample", {
egress: [{
cidrBlocks: ["0.0.0.0/0"],
fromPort: 0,
protocol: "-1",
toPort: 0,
}],
});
const sampleVpc = new aws.ec2.Vpc("sample", {
cidrBlock: "10.1.0.0/16",
});
const sampleSubnet = new aws.ec2.Subnet("sample", {
cidrBlock: "10.1.1.0/24",
vpcId: sampleVpc.id,
});
const sampleComputeEnvironment = new aws.batch.ComputeEnvironment("sample", {
computeEnvironmentName: "sample",
computeResources: {
instanceRole: ecsInstanceRoleInstanceProfile.arn,
instanceTypes: ["c4.large"],
maxVcpus: 16,
minVcpus: 0,
securityGroupIds: [sampleSecurityGroup.id],
subnets: [sampleSubnet.id],
type: "EC2",
},
serviceRole: awsBatchServiceRoleRole.arn,
type: "MANAGED",
}, { dependsOn: [awsBatchServiceRoleRolePolicyAttachment] });constructor
new ComputeEnvironment(name: string, args: ComputeEnvironmentArgs, opts?: pulumi.CustomResourceOptions)Create a ComputeEnvironment resource with the given unique name, arguments, and options.
nameThe unique name of the resource.argsThe arguments to use to populate this resource's properties.optsA bag of options that control this resource's behavior.
method get
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ComputeEnvironmentState, opts?: pulumi.CustomResourceOptions): ComputeEnvironmentGet an existing ComputeEnvironment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefinedmethod isInstance
public static isInstance(obj: any): obj is ComputeEnvironmentReturns true if the given object is an instance of ComputeEnvironment. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
property arn
public arn: pulumi.Output<string>;The Amazon Resource Name (ARN) of the compute environment.
property computeEnvironmentName
public computeEnvironmentName: pulumi.Output<string>;The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.
property computeEnvironmentNamePrefix
public computeEnvironmentNamePrefix: pulumi.Output<string | undefined>;Creates a unique compute environment name beginning with the specified prefix. Conflicts with computeEnvironmentName.
property computeResources
public computeResources: pulumi.Output<ComputeEnvironmentComputeResources | undefined>;Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.
property ecsClusterArn
public ecsClusterArn: pulumi.Output<string>;The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.
property id
id: Output<ID>;id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.
property serviceRole
public serviceRole: pulumi.Output<string>;The full Amazon Resource Name (ARN) of the IAM role that allows AWS Batch to make calls to other AWS services on your behalf.
property state
public state: pulumi.Output<string | undefined>;The state of the compute environment. If the state is ENABLED, then the compute environment accepts jobs from a queue and can scale out automatically based on queues. Valid items are ENABLED or DISABLED. Defaults to ENABLED.
property status
public status: pulumi.Output<string>;The current status of the compute environment (for example, CREATING or VALID).
property statusReason
public statusReason: pulumi.Output<string>;A short, human-readable string to provide additional details about the current status of the compute environment.
property type
public type: pulumi.Output<string>;The type of compute environment. Valid items are EC2 or SPOT.
property urn
urn: Output<URN>;urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
Resource JobDefinition
class JobDefinition extends CustomResourceProvides a Batch Job Definition resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.batch.JobDefinition("test", {
containerProperties: `{
"command": ["ls", "-la"],
"image": "busybox",
"memory": 1024,
"vcpus": 1,
"volumes": [
{
"host": {
"sourcePath": "/tmp"
},
"name": "tmp"
}
],
"environment": [
{"name": "VARNAME", "value": "VARVAL"}
],
"mountPoints": [
{
"sourceVolume": "tmp",
"containerPath": "/tmp",
"readOnly": false
}
],
"ulimits": [
{
"hardLimit": 1024,
"name": "nofile",
"softLimit": 1024
}
]
}
`,
type: "container",
});constructor
new JobDefinition(name: string, args: JobDefinitionArgs, opts?: pulumi.CustomResourceOptions)Create a JobDefinition resource with the given unique name, arguments, and options.
nameThe unique name of the resource.argsThe arguments to use to populate this resource's properties.optsA bag of options that control this resource's behavior.
method get
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: JobDefinitionState, opts?: pulumi.CustomResourceOptions): JobDefinitionGet an existing JobDefinition resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefinedmethod isInstance
public static isInstance(obj: any): obj is JobDefinitionReturns true if the given object is an instance of JobDefinition. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
property arn
public arn: pulumi.Output<string>;The Amazon Resource Name of the job definition.
property containerProperties
public containerProperties: pulumi.Output<string | undefined>;A valid container properties
provided as a single valid JSON document. This parameter is required if the type parameter is container.
property id
id: Output<ID>;id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.
property name
public name: pulumi.Output<string>;Specifies the name of the job definition.
property parameters
public parameters: pulumi.Output<{[key: string]: string} | undefined>;Specifies the parameter substitution placeholders to set in the job definition.
property retryStrategy
public retryStrategy: pulumi.Output<JobDefinitionRetryStrategy | undefined>;Specifies the retry strategy to use for failed jobs that are submitted with this job definition.
Maximum number of retryStrategy is 1. Defined below.
property revision
public revision: pulumi.Output<number>;The revision of the job definition.
property timeout
public timeout: pulumi.Output<JobDefinitionTimeout | undefined>;Specifies the timeout for jobs so that if a job runs longer, AWS Batch terminates the job. Maximum number of timeout is 1. Defined below.
property type
public type: pulumi.Output<string>;The type of job definition. Must be container
property urn
urn: Output<URN>;urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
Resource JobQueue
class JobQueue extends CustomResourceProvides a Batch Job Queue resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const testQueue = new aws.batch.JobQueue("test_queue", {
computeEnvironments: [
aws_batch_compute_environment_test_environment_1.arn,
aws_batch_compute_environment_test_environment_2.arn,
],
priority: 1,
state: "ENABLED",
});constructor
new JobQueue(name: string, args: JobQueueArgs, opts?: pulumi.CustomResourceOptions)Create a JobQueue resource with the given unique name, arguments, and options.
nameThe unique name of the resource.argsThe arguments to use to populate this resource's properties.optsA bag of options that control this resource's behavior.
method get
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: JobQueueState, opts?: pulumi.CustomResourceOptions): JobQueueGet an existing JobQueue resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefinedmethod isInstance
public static isInstance(obj: any): obj is JobQueueReturns true if the given object is an instance of JobQueue. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
property arn
public arn: pulumi.Output<string>;The Amazon Resource Name of the job queue.
property computeEnvironments
public computeEnvironments: pulumi.Output<string[]>;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. You can associate up to 3 compute environments with a job queue.
property id
id: Output<ID>;id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.
property name
public name: pulumi.Output<string>;Specifies the name of the job queue.
property priority
public priority: pulumi.Output<number>;The priority of the job queue. Job queues with a higher priority are evaluated first when associated with the same compute environment.
property state
public state: pulumi.Output<string>;The state of the job queue. Must be one of: ENABLED or DISABLED
property urn
urn: Output<URN>;urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
Functions
Function getComputeEnvironment
getComputeEnvironment(args: GetComputeEnvironmentArgs, opts?: pulumi.InvokeOptions): Promise<GetComputeEnvironmentResult>The Batch Compute Environment data source allows access to details of a specific compute environment within AWS Batch.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const batch_mongo = pulumi.output(aws.batch.getComputeEnvironment({
computeEnvironmentName: "batch-mongo-production",
}, { async: true }));Function getJobQueue
getJobQueue(args: GetJobQueueArgs, opts?: pulumi.InvokeOptions): Promise<GetJobQueueResult>The Batch Job Queue data source allows access to details of a specific job queue within AWS Batch.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test_queue = pulumi.output(aws.batch.getJobQueue({
name: "tf-test-batch-job-queue",
}, { async: true }));Others
interface ComputeEnvironmentArgs
interface ComputeEnvironmentArgsThe set of arguments for constructing a ComputeEnvironment resource.
property computeEnvironmentName
computeEnvironmentName?: pulumi.Input<string>;The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.
property computeEnvironmentNamePrefix
computeEnvironmentNamePrefix?: pulumi.Input<string>;Creates a unique compute environment name beginning with the specified prefix. Conflicts with computeEnvironmentName.
property computeResources
computeResources?: pulumi.Input<ComputeEnvironmentComputeResources>;Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.
property serviceRole
serviceRole: pulumi.Input<string>;The full Amazon Resource Name (ARN) of the IAM role that allows AWS Batch to make calls to other AWS services on your behalf.
property state
state?: pulumi.Input<string>;The state of the compute environment. If the state is ENABLED, then the compute environment accepts jobs from a queue and can scale out automatically based on queues. Valid items are ENABLED or DISABLED. Defaults to ENABLED.
property type
type: pulumi.Input<string>;The type of compute environment. Valid items are EC2 or SPOT.
interface ComputeEnvironmentState
interface ComputeEnvironmentStateInput properties used for looking up and filtering ComputeEnvironment resources.
property arn
arn?: pulumi.Input<string>;The Amazon Resource Name (ARN) of the compute environment.
property computeEnvironmentName
computeEnvironmentName?: pulumi.Input<string>;The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.
property computeEnvironmentNamePrefix
computeEnvironmentNamePrefix?: pulumi.Input<string>;Creates a unique compute environment name beginning with the specified prefix. Conflicts with computeEnvironmentName.
property computeResources
computeResources?: pulumi.Input<ComputeEnvironmentComputeResources>;Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.
property ecsClusterArn
ecsClusterArn?: pulumi.Input<string>;The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.
property serviceRole
serviceRole?: pulumi.Input<string>;The full Amazon Resource Name (ARN) of the IAM role that allows AWS Batch to make calls to other AWS services on your behalf.
property state
state?: pulumi.Input<string>;The state of the compute environment. If the state is ENABLED, then the compute environment accepts jobs from a queue and can scale out automatically based on queues. Valid items are ENABLED or DISABLED. Defaults to ENABLED.
property status
status?: pulumi.Input<string>;The current status of the compute environment (for example, CREATING or VALID).
property statusReason
statusReason?: pulumi.Input<string>;A short, human-readable string to provide additional details about the current status of the compute environment.
property type
type?: pulumi.Input<string>;The type of compute environment. Valid items are EC2 or SPOT.
interface GetComputeEnvironmentArgs
interface GetComputeEnvironmentArgsA collection of arguments for invoking getComputeEnvironment.
property computeEnvironmentName
computeEnvironmentName: string;The name of the Batch Compute Environment
interface GetComputeEnvironmentResult
interface GetComputeEnvironmentResultA collection of values returned by getComputeEnvironment.
property arn
arn: string;The ARN of the compute environment.
property computeEnvironmentName
computeEnvironmentName: string;property ecsClusterArn
ecsClusterArn: string;The ARN of the underlying Amazon ECS cluster used by the compute environment.
property id
id: string;The provider-assigned unique ID for this managed resource.
property serviceRole
serviceRole: string;The ARN of the IAM role that allows AWS Batch to make calls to other AWS services on your behalf.
property state
state: string;The state of the compute environment (for example, ENABLED or DISABLED). If the state is ENABLED, then the compute environment accepts jobs from a queue and can scale out automatically based on queues.
property status
status: string;The current status of the compute environment (for example, CREATING or VALID).
property statusReason
statusReason: string;A short, human-readable string to provide additional details about the current status of the compute environment.
property type
type: string;The type of the compute environment (for example, MANAGED or UNMANAGED).
interface GetJobQueueArgs
interface GetJobQueueArgsA collection of arguments for invoking getJobQueue.
property name
name: string;The name of the job queue.
interface GetJobQueueResult
interface GetJobQueueResultA collection of values returned by getJobQueue.
property arn
arn: string;The ARN of the job queue.
property computeEnvironmentOrders
computeEnvironmentOrders: GetJobQueueComputeEnvironmentOrder[];The compute environments that are attached to the job queue and the order in
which job placement is preferred. Compute environments are selected for job placement in ascending order.
* compute_environment_order.#.order - The order of the compute environment.
* compute_environment_order.#.compute_environment - The ARN of the compute environment.
property id
id: string;The provider-assigned unique ID for this managed resource.
property name
name: string;property priority
priority: number;The priority of the job queue. Job queues with a higher priority are evaluated first when associated with the same compute environment.
property state
state: string;Describes the ability of the queue to accept new jobs (for example, ENABLED or DISABLED).
property status
status: string;The current status of the job queue (for example, CREATING or VALID).
property statusReason
statusReason: string;A short, human-readable string to provide additional details about the current status of the job queue.
interface JobDefinitionArgs
interface JobDefinitionArgsThe set of arguments for constructing a JobDefinition resource.
property containerProperties
containerProperties?: pulumi.Input<string>;A valid container properties
provided as a single valid JSON document. This parameter is required if the type parameter is container.
property name
name?: pulumi.Input<string>;Specifies the name of the job definition.
property parameters
parameters?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;Specifies the parameter substitution placeholders to set in the job definition.
property retryStrategy
retryStrategy?: pulumi.Input<JobDefinitionRetryStrategy>;Specifies the retry strategy to use for failed jobs that are submitted with this job definition.
Maximum number of retryStrategy is 1. Defined below.
property timeout
timeout?: pulumi.Input<JobDefinitionTimeout>;Specifies the timeout for jobs so that if a job runs longer, AWS Batch terminates the job. Maximum number of timeout is 1. Defined below.
property type
type: pulumi.Input<string>;The type of job definition. Must be container
interface JobDefinitionState
interface JobDefinitionStateInput properties used for looking up and filtering JobDefinition resources.
property arn
arn?: pulumi.Input<string>;The Amazon Resource Name of the job definition.
property containerProperties
containerProperties?: pulumi.Input<string>;A valid container properties
provided as a single valid JSON document. This parameter is required if the type parameter is container.
property name
name?: pulumi.Input<string>;Specifies the name of the job definition.
property parameters
parameters?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;Specifies the parameter substitution placeholders to set in the job definition.
property retryStrategy
retryStrategy?: pulumi.Input<JobDefinitionRetryStrategy>;Specifies the retry strategy to use for failed jobs that are submitted with this job definition.
Maximum number of retryStrategy is 1. Defined below.
property revision
revision?: pulumi.Input<number>;The revision of the job definition.
property timeout
timeout?: pulumi.Input<JobDefinitionTimeout>;Specifies the timeout for jobs so that if a job runs longer, AWS Batch terminates the job. Maximum number of timeout is 1. Defined below.
property type
type?: pulumi.Input<string>;The type of job definition. Must be container
interface JobQueueArgs
interface JobQueueArgsThe set of arguments for constructing a JobQueue resource.
property computeEnvironments
computeEnvironments: pulumi.Input<pulumi.Input<string>[]>;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. You can associate up to 3 compute environments with a job queue.
property name
name?: pulumi.Input<string>;Specifies the name of the job queue.
property priority
priority: pulumi.Input<number>;The priority of the job queue. Job queues with a higher priority are evaluated first when associated with the same compute environment.
property state
state: pulumi.Input<string>;The state of the job queue. Must be one of: ENABLED or DISABLED
interface JobQueueState
interface JobQueueStateInput properties used for looking up and filtering JobQueue resources.
property arn
arn?: pulumi.Input<string>;The Amazon Resource Name of the job queue.
property computeEnvironments
computeEnvironments?: pulumi.Input<pulumi.Input<string>[]>;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. You can associate up to 3 compute environments with a job queue.
property name
name?: pulumi.Input<string>;Specifies the name of the job queue.
property priority
priority?: pulumi.Input<number>;The priority of the job queue. Job queues with a higher priority are evaluated first when associated with the same compute environment.
property state
state?: pulumi.Input<string>;The state of the job queue. Must be one of: ENABLED or DISABLED