JobDefinition

class JobDefinition : KotlinCustomResource

Provides a Batch Job Definition resource.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.batch.JobDefinition;
import com.pulumi.aws.batch.JobDefinitionArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
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 test = new JobDefinition("test", JobDefinitionArgs.builder()
.type("container")
.containerProperties(serializeJson(
jsonObject(
jsonProperty("command", jsonArray(
"ls",
"-la"
)),
jsonProperty("image", "busybox"),
jsonProperty("resourceRequirements", jsonArray(
jsonObject(
jsonProperty("type", "VCPU"),
jsonProperty("value", "0.25")
),
jsonObject(
jsonProperty("type", "MEMORY"),
jsonProperty("value", "512")
)
)),
jsonProperty("volumes", jsonArray(jsonObject(
jsonProperty("host", jsonObject(
jsonProperty("sourcePath", "/tmp")
)),
jsonProperty("name", "tmp")
))),
jsonProperty("environment", jsonArray(jsonObject(
jsonProperty("name", "VARNAME"),
jsonProperty("value", "VARVAL")
))),
jsonProperty("mountPoints", jsonArray(jsonObject(
jsonProperty("sourceVolume", "tmp"),
jsonProperty("containerPath", "/tmp"),
jsonProperty("readOnly", false)
))),
jsonProperty("ulimits", jsonArray(jsonObject(
jsonProperty("hardLimit", 1024),
jsonProperty("name", "nofile"),
jsonProperty("softLimit", 1024)
)))
)))
.build());
}
}

Fargate Platform Capability

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicyAttachment;
import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
import com.pulumi.aws.batch.JobDefinition;
import com.pulumi.aws.batch.JobDefinitionArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
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) {
final var assumeRolePolicy = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.actions("sts:AssumeRole")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("ecs-tasks.amazonaws.com")
.build())
.build())
.build());
var ecsTaskExecutionRole = new Role("ecsTaskExecutionRole", RoleArgs.builder()
.assumeRolePolicy(assumeRolePolicy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var ecsTaskExecutionRolePolicy = new RolePolicyAttachment("ecsTaskExecutionRolePolicy", RolePolicyAttachmentArgs.builder()
.role(ecsTaskExecutionRole.name())
.policyArn("arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy")
.build());
var test = new JobDefinition("test", JobDefinitionArgs.builder()
.type("container")
.platformCapabilities("FARGATE")
.containerProperties(ecsTaskExecutionRole.arn().applyValue(arn -> serializeJson(
jsonObject(
jsonProperty("command", jsonArray(
"echo",
"test"
)),
jsonProperty("image", "busybox"),
jsonProperty("jobRoleArn", "arn:aws:iam::123456789012:role/AWSBatchS3ReadOnly"),
jsonProperty("fargatePlatformConfiguration", jsonObject(
jsonProperty("platformVersion", "LATEST")
)),
jsonProperty("resourceRequirements", jsonArray(
jsonObject(
jsonProperty("type", "VCPU"),
jsonProperty("value", "0.25")
),
jsonObject(
jsonProperty("type", "MEMORY"),
jsonProperty("value", "512")
)
)),
jsonProperty("executionRoleArn", arn)
))))
.build());
}
}

Import

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

$ pulumi import aws:batch/jobDefinition:JobDefinition test arn:aws:batch:us-east-1:123456789012:job-definition/sample

Properties

Link copied to clipboard
val arn: Output<String>

The Amazon Resource Name of the job definition.

Link copied to clipboard

A valid container properties provided as a single valid JSON document. This parameter is required if the type parameter is container.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

Specifies the name of the job definition.

Link copied to clipboard
val parameters: Output<Map<String, String>>?

Specifies the parameter substitution placeholders to set in the job definition.

Link copied to clipboard

The platform capabilities required by the job definition. If no value is specified, it defaults to EC2. To run the job on Fargate resources, specify FARGATE.

Link copied to clipboard
val propagateTags: Output<Boolean>?

Specifies whether to propagate the tags from the job definition to the corresponding Amazon ECS task. Default is false.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Specifies the retry strategy to use for failed jobs that are submitted with this job definition. Maximum number of retry_strategy is 1. Defined below.

Link copied to clipboard
val revision: Output<Int>

The revision of the job definition.

Link copied to clipboard
val tags: Output<Map<String, String>>?

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard

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.

Link copied to clipboard
val type: Output<String>

The type of job definition. Must be container. The following arguments are optional:

Link copied to clipboard
val urn: Output<String>