JobDefinitionContainer

class aws_cdk.aws_batch.JobDefinitionContainer(*, image, assign_public_ip=None, command=None, environment=None, execution_role=None, gpu_count=None, instance_type=None, job_role=None, linux_params=None, log_configuration=None, memory_limit_mib=None, mount_points=None, platform_version=None, privileged=None, read_only=None, ulimits=None, user=None, vcpus=None, volumes=None)

Bases: object

(experimental) Properties of a job definition container.

Parameters:
  • image (ContainerImage) – (experimental) The image used to start a container.

  • assign_public_ip (Optional[bool]) – (experimental) Whether or not to assign a public IP to the job. Default: - false

  • command (Optional[Sequence[str]]) – (experimental) The command that is passed to the container. If you provide a shell command as a single string, you have to quote command-line arguments. Default: - CMD value built into container image.

  • environment (Optional[Mapping[str, str]]) – (experimental) The environment variables to pass to the container. Default: none

  • execution_role (Optional[IRole]) – (experimental) The IAM role that AWS Batch can assume. Required when using Fargate. Default: - None

  • gpu_count (Union[int, float, None]) – (experimental) The number of physical GPUs to reserve for the container. The number of GPUs reserved for all containers in a job should not exceed the number of available GPUs on the compute resource that the job is launched on. Default: - No GPU reservation.

  • instance_type (Optional[InstanceType]) – (experimental) The instance type to use for a multi-node parallel job. Currently all node groups in a multi-node parallel job must use the same instance type. This parameter is not valid for single-node container jobs. Default: - None

  • job_role (Optional[IRole]) – (experimental) The IAM role that the container can assume for AWS permissions. Default: - An IAM role will created.

  • linux_params (Optional[LinuxParameters]) – (experimental) Linux-specific modifications that are applied to the container, such as details for device mappings. For now, only the devices property is supported. Default: - None will be used.

  • log_configuration (Union[LogConfiguration, Dict[str, Any], None]) – (experimental) The log configuration specification for the container. Default: - containers use the same logging driver that the Docker daemon uses

  • memory_limit_mib (Union[int, float, None]) – (experimental) The hard limit (in MiB) of memory to present to the container. If your container attempts to exceed the memory specified here, the container is killed. You must specify at least 4 MiB of memory for EC2 and 512 MiB for Fargate. Default: - 4 for EC2, 512 for Fargate

  • mount_points (Optional[Sequence[Union[MountPoint, Dict[str, Any]]]]) – (experimental) The mount points for data volumes in your container. Default: - No mount points will be used.

  • platform_version (Optional[FargatePlatformVersion]) – (experimental) Fargate platform version. Default: - LATEST platform version will be used

  • privileged (Optional[bool]) – (experimental) When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user). Default: false

  • read_only (Optional[bool]) – (experimental) When this parameter is true, the container is given read-only access to its root file system. Default: false

  • ulimits (Optional[Sequence[Union[Ulimit, Dict[str, Any]]]]) – (experimental) A list of ulimits to set in the container. Default: - No limits.

  • user (Optional[str]) – (experimental) The user name to use inside the container. Default: - None will be used.

  • vcpus (Union[int, float, None]) – (experimental) The number of vCPUs reserved for the container. Each vCPU is equivalent to 1,024 CPU shares. You must specify at least one vCPU for EC2 and 0.25 for Fargate. Default: - 1 for EC2, 0.25 for Fargate

  • volumes (Optional[Sequence[Union[Volume, Dict[str, Any]]]]) – (experimental) A list of data volumes used in a job. Default: - No data volumes will be used.

Stability:

experimental

ExampleMetadata:

infused

Example:

import aws_cdk.aws_ssm as ssm


batch.JobDefinition(self, "job-def",
    container=batch.JobDefinitionContainer(
        image=ecs.EcrImage.from_registry("docker/whalesay"),
        log_configuration=batch.LogConfiguration(
            log_driver=batch.LogDriver.AWSLOGS,
            options={"awslogs-region": "us-east-1"},
            secret_options=[
                batch.ExposedSecret.from_parameters_store("xyz", ssm.StringParameter.from_string_parameter_name(self, "parameter", "xyz"))
            ]
        )
    )
)

Attributes

assign_public_ip

(experimental) Whether or not to assign a public IP to the job.

Default:
  • false

Stability:

experimental

command

(experimental) The command that is passed to the container.

If you provide a shell command as a single string, you have to quote command-line arguments.

Default:
  • CMD value built into container image.

Stability:

experimental

environment

(experimental) The environment variables to pass to the container.

Default:

none

Stability:

experimental

execution_role

(experimental) The IAM role that AWS Batch can assume.

Required when using Fargate.

Default:
  • None

Stability:

experimental

gpu_count

(experimental) The number of physical GPUs to reserve for the container.

The number of GPUs reserved for all containers in a job should not exceed the number of available GPUs on the compute resource that the job is launched on.

Default:
  • No GPU reservation.

Stability:

experimental

image

(experimental) The image used to start a container.

Stability:

experimental

instance_type

(experimental) The instance type to use for a multi-node parallel job.

Currently all node groups in a multi-node parallel job must use the same instance type. This parameter is not valid for single-node container jobs.

Default:
  • None

Stability:

experimental

job_role

(experimental) The IAM role that the container can assume for AWS permissions.

Default:
  • An IAM role will created.

Stability:

experimental

linux_params

(experimental) Linux-specific modifications that are applied to the container, such as details for device mappings.

For now, only the devices property is supported.

Default:
  • None will be used.

Stability:

experimental

log_configuration

(experimental) The log configuration specification for the container.

Default:
  • containers use the same logging driver that the Docker daemon uses

Stability:

experimental

memory_limit_mib

(experimental) The hard limit (in MiB) of memory to present to the container.

If your container attempts to exceed the memory specified here, the container is killed. You must specify at least 4 MiB of memory for EC2 and 512 MiB for Fargate.

Default:
  • 4 for EC2, 512 for Fargate

Stability:

experimental

mount_points

(experimental) The mount points for data volumes in your container.

Default:
  • No mount points will be used.

Stability:

experimental

platform_version

(experimental) Fargate platform version.

Default:
  • LATEST platform version will be used

Stability:

experimental

privileged

(experimental) When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user).

Default:

false

Stability:

experimental

read_only

(experimental) When this parameter is true, the container is given read-only access to its root file system.

Default:

false

Stability:

experimental

ulimits

(experimental) A list of ulimits to set in the container.

Default:
  • No limits.

Stability:

experimental

user

(experimental) The user name to use inside the container.

Default:
  • None will be used.

Stability:

experimental

vcpus

(experimental) The number of vCPUs reserved for the container.

Each vCPU is equivalent to 1,024 CPU shares. You must specify at least one vCPU for EC2 and 0.25 for Fargate.

Default:
  • 1 for EC2, 0.25 for Fargate

Stability:

experimental

volumes

(experimental) A list of data volumes used in a job.

Default:
  • No data volumes will be used.

Stability:

experimental