aws logo
AWS Classic v5.29.1, Feb 4 23

aws.batch.JobDefinition

Provides a Batch Job Definition resource.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var test = new Aws.Batch.JobDefinition("test", new()
    {
        ContainerProperties = @"{
	""command"": [""ls"", ""-la""],
	""image"": ""busybox"",
	""resourceRequirements"": [
    {""type"": ""VCPU"", ""value"": ""0.25""},
    {""type"": ""MEMORY"", ""value"": ""512""}
  ],
	""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",
    });

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/batch"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := batch.NewJobDefinition(ctx, "test", &batch.JobDefinitionArgs{
			ContainerProperties: pulumi.String(fmt.Sprintf(`{
	"command": ["ls", "-la"],
	"image": "busybox",
	"resourceRequirements": [
    {"type": "VCPU", "value": "0.25"},
    {"type": "MEMORY", "value": "512"}
  ],
	"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: pulumi.String("container"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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 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()        
            .containerProperties("""
{
	"command": ["ls", "-la"],
	"image": "busybox",
	"resourceRequirements": [
    {"type": "VCPU", "value": "0.25"},
    {"type": "MEMORY", "value": "512"}
  ],
	"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")
            .build());

    }
}
import pulumi
import pulumi_aws as aws

test = aws.batch.JobDefinition("test",
    container_properties="""{
	"command": ["ls", "-la"],
	"image": "busybox",
	"resourceRequirements": [
    {"type": "VCPU", "value": "0.25"},
    {"type": "MEMORY", "value": "512"}
  ],
	"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")
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",
	"resourceRequirements": [
    {"type": "VCPU", "value": "0.25"},
    {"type": "MEMORY", "value": "512"}
  ],
	"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",
});
resources:
  test:
    type: aws:batch:JobDefinition
    properties:
      containerProperties: |+
        {
        	"command": ["ls", "-la"],
        	"image": "busybox",
        	"resourceRequirements": [
            {"type": "VCPU", "value": "0.25"},
            {"type": "MEMORY", "value": "512"}
          ],
        	"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

Fargate Platform Capability

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var assumeRolePolicy = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Actions = new[]
                {
                    "sts:AssumeRole",
                },
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "Service",
                        Identifiers = new[]
                        {
                            "ecs-tasks.amazonaws.com",
                        },
                    },
                },
            },
        },
    });

    var ecsTaskExecutionRole = new Aws.Iam.Role("ecsTaskExecutionRole", new()
    {
        AssumeRolePolicy = assumeRolePolicy.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

    var ecsTaskExecutionRolePolicy = new Aws.Iam.RolePolicyAttachment("ecsTaskExecutionRolePolicy", new()
    {
        Role = ecsTaskExecutionRole.Name,
        PolicyArn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy",
    });

    var test = new Aws.Batch.JobDefinition("test", new()
    {
        Type = "container",
        PlatformCapabilities = new[]
        {
            "FARGATE",
        },
        ContainerProperties = ecsTaskExecutionRole.Arn.Apply(arn => @$"{{
  ""command"": [""echo"", ""test""],
  ""image"": ""busybox"",
  ""fargatePlatformConfiguration"": {{
    ""platformVersion"": ""LATEST""
  }},
  ""resourceRequirements"": [
    {{""type"": ""VCPU"", ""value"": ""0.25""}},
    {{""type"": ""MEMORY"", ""value"": ""512""}}
  ],
  ""executionRoleArn"": ""{arn}""
}}
"),
    });

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/batch"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		assumeRolePolicy, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Actions: []string{
						"sts:AssumeRole",
					},
					Principals: []iam.GetPolicyDocumentStatementPrincipal{
						{
							Type: "Service",
							Identifiers: []string{
								"ecs-tasks.amazonaws.com",
							},
						},
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		ecsTaskExecutionRole, err := iam.NewRole(ctx, "ecsTaskExecutionRole", &iam.RoleArgs{
			AssumeRolePolicy: *pulumi.String(assumeRolePolicy.Json),
		})
		if err != nil {
			return err
		}
		_, err = iam.NewRolePolicyAttachment(ctx, "ecsTaskExecutionRolePolicy", &iam.RolePolicyAttachmentArgs{
			Role:      ecsTaskExecutionRole.Name,
			PolicyArn: pulumi.String("arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"),
		})
		if err != nil {
			return err
		}
		_, err = batch.NewJobDefinition(ctx, "test", &batch.JobDefinitionArgs{
			Type: pulumi.String("container"),
			PlatformCapabilities: pulumi.StringArray{
				pulumi.String("FARGATE"),
			},
			ContainerProperties: ecsTaskExecutionRole.Arn.ApplyT(func(arn string) (string, error) {
				return fmt.Sprintf(`{
  "command": ["echo", "test"],
  "image": "busybox",
  "fargatePlatformConfiguration": {
    "platformVersion": "LATEST"
  },
  "resourceRequirements": [
    {"type": "VCPU", "value": "0.25"},
    {"type": "MEMORY", "value": "512"}
  ],
  "executionRoleArn": "%v"
}
`, arn), nil
			}).(pulumi.StringOutput),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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 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 -> """
{
  "command": ["echo", "test"],
  "image": "busybox",
  "fargatePlatformConfiguration": {
    "platformVersion": "LATEST"
  },
  "resourceRequirements": [
    {"type": "VCPU", "value": "0.25"},
    {"type": "MEMORY", "value": "512"}
  ],
  "executionRoleArn": "%s"
}
", arn)))
            .build());

    }
}
import pulumi
import pulumi_aws as aws

assume_role_policy = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
    actions=["sts:AssumeRole"],
    principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
        type="Service",
        identifiers=["ecs-tasks.amazonaws.com"],
    )],
)])
ecs_task_execution_role = aws.iam.Role("ecsTaskExecutionRole", assume_role_policy=assume_role_policy.json)
ecs_task_execution_role_policy = aws.iam.RolePolicyAttachment("ecsTaskExecutionRolePolicy",
    role=ecs_task_execution_role.name,
    policy_arn="arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy")
test = aws.batch.JobDefinition("test",
    type="container",
    platform_capabilities=["FARGATE"],
    container_properties=ecs_task_execution_role.arn.apply(lambda arn: f"""{{
  "command": ["echo", "test"],
  "image": "busybox",
  "fargatePlatformConfiguration": {{
    "platformVersion": "LATEST"
  }},
  "resourceRequirements": [
    {{"type": "VCPU", "value": "0.25"}},
    {{"type": "MEMORY", "value": "512"}}
  ],
  "executionRoleArn": "{arn}"
}}
"""))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const assumeRolePolicy = aws.iam.getPolicyDocument({
    statements: [{
        actions: ["sts:AssumeRole"],
        principals: [{
            type: "Service",
            identifiers: ["ecs-tasks.amazonaws.com"],
        }],
    }],
});
const ecsTaskExecutionRole = new aws.iam.Role("ecsTaskExecutionRole", {assumeRolePolicy: assumeRolePolicy.then(assumeRolePolicy => assumeRolePolicy.json)});
const ecsTaskExecutionRolePolicy = new aws.iam.RolePolicyAttachment("ecsTaskExecutionRolePolicy", {
    role: ecsTaskExecutionRole.name,
    policyArn: "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy",
});
const test = new aws.batch.JobDefinition("test", {
    type: "container",
    platformCapabilities: ["FARGATE"],
    containerProperties: pulumi.interpolate`{
  "command": ["echo", "test"],
  "image": "busybox",
  "fargatePlatformConfiguration": {
    "platformVersion": "LATEST"
  },
  "resourceRequirements": [
    {"type": "VCPU", "value": "0.25"},
    {"type": "MEMORY", "value": "512"}
  ],
  "executionRoleArn": "${ecsTaskExecutionRole.arn}"
}
`,
});
resources:
  ecsTaskExecutionRole:
    type: aws:iam:Role
    properties:
      assumeRolePolicy: ${assumeRolePolicy.json}
  ecsTaskExecutionRolePolicy:
    type: aws:iam:RolePolicyAttachment
    properties:
      role: ${ecsTaskExecutionRole.name}
      policyArn: arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy
  test:
    type: aws:batch:JobDefinition
    properties:
      type: container
      platformCapabilities:
        - FARGATE
      containerProperties: |
        {
          "command": ["echo", "test"],
          "image": "busybox",
          "fargatePlatformConfiguration": {
            "platformVersion": "LATEST"
          },
          "resourceRequirements": [
            {"type": "VCPU", "value": "0.25"},
            {"type": "MEMORY", "value": "512"}
          ],
          "executionRoleArn": "${ecsTaskExecutionRole.arn}"
        }        
variables:
  assumeRolePolicy:
    fn::invoke:
      Function: aws:iam:getPolicyDocument
      Arguments:
        statements:
          - actions:
              - sts:AssumeRole
            principals:
              - type: Service
                identifiers:
                  - ecs-tasks.amazonaws.com

Create JobDefinition Resource

new JobDefinition(name: string, args: JobDefinitionArgs, opts?: CustomResourceOptions);
@overload
def JobDefinition(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  container_properties: Optional[str] = None,
                  name: Optional[str] = None,
                  parameters: Optional[Mapping[str, str]] = None,
                  platform_capabilities: Optional[Sequence[str]] = None,
                  propagate_tags: Optional[bool] = None,
                  retry_strategy: Optional[JobDefinitionRetryStrategyArgs] = None,
                  tags: Optional[Mapping[str, str]] = None,
                  timeout: Optional[JobDefinitionTimeoutArgs] = None,
                  type: Optional[str] = None)
@overload
def JobDefinition(resource_name: str,
                  args: JobDefinitionArgs,
                  opts: Optional[ResourceOptions] = None)
func NewJobDefinition(ctx *Context, name string, args JobDefinitionArgs, opts ...ResourceOption) (*JobDefinition, error)
public JobDefinition(string name, JobDefinitionArgs args, CustomResourceOptions? opts = null)
public JobDefinition(String name, JobDefinitionArgs args)
public JobDefinition(String name, JobDefinitionArgs args, CustomResourceOptions options)
type: aws:batch:JobDefinition
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args JobDefinitionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args JobDefinitionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args JobDefinitionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args JobDefinitionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args JobDefinitionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

JobDefinition Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The JobDefinition resource accepts the following input properties:

Type string

The type of job definition. Must be container.

ContainerProperties string

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

Name string

Specifies the name of the job definition.

Parameters Dictionary<string, string>

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

PlatformCapabilities List<string>

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.

PropagateTags bool

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

RetryStrategy JobDefinitionRetryStrategyArgs

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.

Tags Dictionary<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.

Timeout JobDefinitionTimeoutArgs

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.

Type string

The type of job definition. Must be container.

ContainerProperties string

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

Name string

Specifies the name of the job definition.

Parameters map[string]string

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

PlatformCapabilities []string

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.

PropagateTags bool

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

RetryStrategy JobDefinitionRetryStrategyArgs

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.

Tags 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.

Timeout JobDefinitionTimeoutArgs

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.

type String

The type of job definition. Must be container.

containerProperties String

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

name String

Specifies the name of the job definition.

parameters Map<String,String>

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

platformCapabilities List<String>

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.

propagateTags Boolean

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

retryStrategy JobDefinitionRetryStrategyArgs

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.

tags 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.

timeout JobDefinitionTimeoutArgs

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.

type string

The type of job definition. Must be container.

containerProperties string

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

name string

Specifies the name of the job definition.

parameters {[key: string]: string}

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

platformCapabilities string[]

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.

propagateTags boolean

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

retryStrategy JobDefinitionRetryStrategyArgs

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.

tags {[key: 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.

timeout JobDefinitionTimeoutArgs

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.

type str

The type of job definition. Must be container.

container_properties str

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

name str

Specifies the name of the job definition.

parameters Mapping[str, str]

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

platform_capabilities Sequence[str]

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.

propagate_tags bool

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

retry_strategy JobDefinitionRetryStrategyArgs

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.

tags Mapping[str, str]

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.

timeout JobDefinitionTimeoutArgs

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.

type String

The type of job definition. Must be container.

containerProperties String

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

name String

Specifies the name of the job definition.

parameters Map<String>

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

platformCapabilities List<String>

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.

propagateTags Boolean

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

retryStrategy Property Map

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.

tags Map<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.

timeout Property Map

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.

Outputs

All input properties are implicitly available as output properties. Additionally, the JobDefinition resource produces the following output properties:

Arn string

The Amazon Resource Name of the job definition.

Id string

The provider-assigned unique ID for this managed resource.

Revision int

The revision of the job definition.

TagsAll Dictionary<string, string>

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

Arn string

The Amazon Resource Name of the job definition.

Id string

The provider-assigned unique ID for this managed resource.

Revision int

The revision of the job definition.

TagsAll map[string]string

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

arn String

The Amazon Resource Name of the job definition.

id String

The provider-assigned unique ID for this managed resource.

revision Integer

The revision of the job definition.

tagsAll Map<String,String>

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

arn string

The Amazon Resource Name of the job definition.

id string

The provider-assigned unique ID for this managed resource.

revision number

The revision of the job definition.

tagsAll {[key: string]: string}

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

arn str

The Amazon Resource Name of the job definition.

id str

The provider-assigned unique ID for this managed resource.

revision int

The revision of the job definition.

tags_all Mapping[str, str]

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

arn String

The Amazon Resource Name of the job definition.

id String

The provider-assigned unique ID for this managed resource.

revision Number

The revision of the job definition.

tagsAll Map<String>

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

Look up Existing JobDefinition Resource

Get an existing JobDefinition resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: JobDefinitionState, opts?: CustomResourceOptions): JobDefinition
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        container_properties: Optional[str] = None,
        name: Optional[str] = None,
        parameters: Optional[Mapping[str, str]] = None,
        platform_capabilities: Optional[Sequence[str]] = None,
        propagate_tags: Optional[bool] = None,
        retry_strategy: Optional[JobDefinitionRetryStrategyArgs] = None,
        revision: Optional[int] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None,
        timeout: Optional[JobDefinitionTimeoutArgs] = None,
        type: Optional[str] = None) -> JobDefinition
func GetJobDefinition(ctx *Context, name string, id IDInput, state *JobDefinitionState, opts ...ResourceOption) (*JobDefinition, error)
public static JobDefinition Get(string name, Input<string> id, JobDefinitionState? state, CustomResourceOptions? opts = null)
public static JobDefinition get(String name, Output<String> id, JobDefinitionState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string

The Amazon Resource Name of the job definition.

ContainerProperties string

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

Name string

Specifies the name of the job definition.

Parameters Dictionary<string, string>

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

PlatformCapabilities List<string>

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.

PropagateTags bool

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

RetryStrategy JobDefinitionRetryStrategyArgs

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.

Revision int

The revision of the job definition.

Tags Dictionary<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.

TagsAll Dictionary<string, string>

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

Timeout JobDefinitionTimeoutArgs

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.

Type string

The type of job definition. Must be container.

Arn string

The Amazon Resource Name of the job definition.

ContainerProperties string

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

Name string

Specifies the name of the job definition.

Parameters map[string]string

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

PlatformCapabilities []string

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.

PropagateTags bool

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

RetryStrategy JobDefinitionRetryStrategyArgs

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.

Revision int

The revision of the job definition.

Tags 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.

TagsAll map[string]string

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

Timeout JobDefinitionTimeoutArgs

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.

Type string

The type of job definition. Must be container.

arn String

The Amazon Resource Name of the job definition.

containerProperties String

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

name String

Specifies the name of the job definition.

parameters Map<String,String>

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

platformCapabilities List<String>

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.

propagateTags Boolean

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

retryStrategy JobDefinitionRetryStrategyArgs

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.

revision Integer

The revision of the job definition.

tags 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.

tagsAll Map<String,String>

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

timeout JobDefinitionTimeoutArgs

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.

type String

The type of job definition. Must be container.

arn string

The Amazon Resource Name of the job definition.

containerProperties string

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

name string

Specifies the name of the job definition.

parameters {[key: string]: string}

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

platformCapabilities string[]

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.

propagateTags boolean

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

retryStrategy JobDefinitionRetryStrategyArgs

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.

revision number

The revision of the job definition.

tags {[key: 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.

tagsAll {[key: string]: string}

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

timeout JobDefinitionTimeoutArgs

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.

type string

The type of job definition. Must be container.

arn str

The Amazon Resource Name of the job definition.

container_properties str

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

name str

Specifies the name of the job definition.

parameters Mapping[str, str]

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

platform_capabilities Sequence[str]

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.

propagate_tags bool

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

retry_strategy JobDefinitionRetryStrategyArgs

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.

revision int

The revision of the job definition.

tags Mapping[str, str]

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.

tags_all Mapping[str, str]

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

timeout JobDefinitionTimeoutArgs

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.

type str

The type of job definition. Must be container.

arn String

The Amazon Resource Name of the job definition.

containerProperties String

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

name String

Specifies the name of the job definition.

parameters Map<String>

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

platformCapabilities List<String>

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.

propagateTags Boolean

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

retryStrategy Property Map

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.

revision Number

The revision of the job definition.

tags Map<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.

tagsAll Map<String>

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

timeout Property Map

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.

type String

The type of job definition. Must be container.

Supporting Types

JobDefinitionRetryStrategy

Attempts int

The number of times to move a job to the RUNNABLE status. You may specify between 1 and 10 attempts.

EvaluateOnExits List<JobDefinitionRetryStrategyEvaluateOnExit>

The evaluate on exit conditions under which the job should be retried or failed. If this parameter is specified, then the attempts parameter must also be specified. You may specify up to 5 configuration blocks.

Attempts int

The number of times to move a job to the RUNNABLE status. You may specify between 1 and 10 attempts.

EvaluateOnExits []JobDefinitionRetryStrategyEvaluateOnExit

The evaluate on exit conditions under which the job should be retried or failed. If this parameter is specified, then the attempts parameter must also be specified. You may specify up to 5 configuration blocks.

attempts Integer

The number of times to move a job to the RUNNABLE status. You may specify between 1 and 10 attempts.

evaluateOnExits List<JobDefinitionRetryStrategyEvaluateOnExit>

The evaluate on exit conditions under which the job should be retried or failed. If this parameter is specified, then the attempts parameter must also be specified. You may specify up to 5 configuration blocks.

attempts number

The number of times to move a job to the RUNNABLE status. You may specify between 1 and 10 attempts.

evaluateOnExits JobDefinitionRetryStrategyEvaluateOnExit[]

The evaluate on exit conditions under which the job should be retried or failed. If this parameter is specified, then the attempts parameter must also be specified. You may specify up to 5 configuration blocks.

attempts int

The number of times to move a job to the RUNNABLE status. You may specify between 1 and 10 attempts.

evaluate_on_exits Sequence[JobDefinitionRetryStrategyEvaluateOnExit]

The evaluate on exit conditions under which the job should be retried or failed. If this parameter is specified, then the attempts parameter must also be specified. You may specify up to 5 configuration blocks.

attempts Number

The number of times to move a job to the RUNNABLE status. You may specify between 1 and 10 attempts.

evaluateOnExits List<Property Map>

The evaluate on exit conditions under which the job should be retried or failed. If this parameter is specified, then the attempts parameter must also be specified. You may specify up to 5 configuration blocks.

JobDefinitionRetryStrategyEvaluateOnExit

Action string

Specifies the action to take if all of the specified conditions are met. The values are not case sensitive. Valid values: RETRY, EXIT.

OnExitCode string

A glob pattern to match against the decimal representation of the exit code returned for a job.

OnReason string

A glob pattern to match against the reason returned for a job.

OnStatusReason string

A glob pattern to match against the status reason returned for a job.

Action string

Specifies the action to take if all of the specified conditions are met. The values are not case sensitive. Valid values: RETRY, EXIT.

OnExitCode string

A glob pattern to match against the decimal representation of the exit code returned for a job.

OnReason string

A glob pattern to match against the reason returned for a job.

OnStatusReason string

A glob pattern to match against the status reason returned for a job.

action String

Specifies the action to take if all of the specified conditions are met. The values are not case sensitive. Valid values: RETRY, EXIT.

onExitCode String

A glob pattern to match against the decimal representation of the exit code returned for a job.

onReason String

A glob pattern to match against the reason returned for a job.

onStatusReason String

A glob pattern to match against the status reason returned for a job.

action string

Specifies the action to take if all of the specified conditions are met. The values are not case sensitive. Valid values: RETRY, EXIT.

onExitCode string

A glob pattern to match against the decimal representation of the exit code returned for a job.

onReason string

A glob pattern to match against the reason returned for a job.

onStatusReason string

A glob pattern to match against the status reason returned for a job.

action str

Specifies the action to take if all of the specified conditions are met. The values are not case sensitive. Valid values: RETRY, EXIT.

on_exit_code str

A glob pattern to match against the decimal representation of the exit code returned for a job.

on_reason str

A glob pattern to match against the reason returned for a job.

on_status_reason str

A glob pattern to match against the status reason returned for a job.

action String

Specifies the action to take if all of the specified conditions are met. The values are not case sensitive. Valid values: RETRY, EXIT.

onExitCode String

A glob pattern to match against the decimal representation of the exit code returned for a job.

onReason String

A glob pattern to match against the reason returned for a job.

onStatusReason String

A glob pattern to match against the status reason returned for a job.

JobDefinitionTimeout

AttemptDurationSeconds int

The time duration in seconds after which AWS Batch terminates your jobs if they have not finished. The minimum value for the timeout is 60 seconds.

AttemptDurationSeconds int

The time duration in seconds after which AWS Batch terminates your jobs if they have not finished. The minimum value for the timeout is 60 seconds.

attemptDurationSeconds Integer

The time duration in seconds after which AWS Batch terminates your jobs if they have not finished. The minimum value for the timeout is 60 seconds.

attemptDurationSeconds number

The time duration in seconds after which AWS Batch terminates your jobs if they have not finished. The minimum value for the timeout is 60 seconds.

attempt_duration_seconds int

The time duration in seconds after which AWS Batch terminates your jobs if they have not finished. The minimum value for the timeout is 60 seconds.

attemptDurationSeconds Number

The time duration in seconds after which AWS Batch terminates your jobs if they have not finished. The minimum value for the timeout is 60 seconds.

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

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.