IEcsEc2ContainerDefinition

class aws_cdk.aws_batch.IEcsEc2ContainerDefinition(*args, **kwargs)

Bases: IEcsContainerDefinition, Protocol

A container orchestrated by ECS that uses EC2 resources.

Methods

add_ulimit(*, hard_limit, name, soft_limit)

Add a ulimit to this container.

Parameters:
  • hard_limit (Union[int, float]) – The hard limit for this resource. The container will be terminated if it exceeds this limit.

  • name (UlimitName) – The resource to limit.

  • soft_limit (Union[int, float]) – The reservation for this resource. The container will not be terminated if it exceeds this limit.

Return type:

None

add_volume(volume)

Add a Volume to this container.

Parameters:

volume (EcsVolume) –

Return type:

None

Attributes

command

The command that’s passed to the container.

See:

https://docs.docker.com/engine/reference/builder/#cmd

cpu

The number of vCPUs reserved for the container.

Each vCPU is equivalent to 1,024 CPU shares. For containers running on EC2 resources, you must specify at least one vCPU.

environment

The environment variables to pass to a container.

Cannot start with AWS_BATCH. We don’t recommend using plaintext environment variables for sensitive information, such as credential data.

Default:
  • no environment variables

execution_role

The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.

See:

https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html

gpu

The number of physical GPUs to reserve for the container.

Make sure that the number of GPUs reserved for all containers in a job doesn’t exceed the number of available GPUs on the compute resource that the job is launched on.

Default:
  • no gpus

image

The image that this container will run.

job_role

The role that the container can assume.

Default:
  • no jobRole

See:

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html

linux_parameters

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

Default:

none

log_driver_config

The configuration of the log driver.

memory

The memory hard limit present to the container.

If your container attempts to exceed the memory specified, the container is terminated. You must specify at least 4 MiB of memory for a job.

node

The tree node.

privileged

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

Default:

false

readonly_root_filesystem

Gives the container readonly access to its root filesystem.

Default:

false

secrets

A map from environment variable names to the secrets for the container.

Allows your job definitions to reference the secret by the environment variable name defined in this property.

Default:
  • no secrets

See:

https://docs.aws.amazon.com/batch/latest/userguide/specifying-sensitive-data.html

ulimits

Limits to set for the user this docker container will run as.

user

The user name to use inside the container.

Default:
  • no user

volumes

The volumes to mount to this container.

Automatically added to the job definition.

Default:
  • no volumes