@aws-cdk_aws-batch-alpha.EcsEc2ContainerDefinitionProps

interface EcsEc2ContainerDefinitionProps ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Batch.Alpha.EcsEc2ContainerDefinitionProps
Gogithub.com/aws/aws-cdk-go/awscdkbatchalpha/v2#EcsEc2ContainerDefinitionProps
Javasoftware.amazon.awscdk.services.batch.alpha.EcsEc2ContainerDefinitionProps
Pythonaws_cdk.aws_batch_alpha.EcsEc2ContainerDefinitionProps
TypeScript (source)@aws-cdk/aws-batch-alpha ยป EcsEc2ContainerDefinitionProps

Props to configure an EcsEc2ContainerDefinition.

Example

import * as cdk from 'aws-cdk-lib';
const multiNodeJob = new batch.MultiNodeJobDefinition(this, 'JobDefinition', {
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.R4, ec2.InstanceSize.LARGE),
  containers: [{
    container: new batch.EcsEc2ContainerDefinition(this, 'mainMPIContainer', {
      image: ecs.ContainerImage.fromRegistry('yourregsitry.com/yourMPIImage:latest'),
      cpu: 256,
      memory: cdk.Size.mebibytes(2048),
    }),
    startNode: 0,
    endNode: 5,
  }],
});
// convenience method
multiNodeJob.addContainer({
  startNode: 6,
  endNode: 10,
  container: new batch.EcsEc2ContainerDefinition(this, 'multiContainer', {
    image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
    cpu: 256,
    memory: cdk.Size.mebibytes(2048),
  }),
});

Properties

NameTypeDescription
cpu๐Ÿ”นnumberThe number of vCPUs reserved for the container.
image๐Ÿ”นContainerImageThe image that this container will run.
memory๐Ÿ”นSizeThe memory hard limit present to the container.
command?๐Ÿ”นstring[]The command that's passed to the container.
environment?๐Ÿ”น{ [string]: string }The environment variables to pass to a container.
executionRole?๐Ÿ”นIRoleThe role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.
gpu?๐Ÿ”นnumberThe number of physical GPUs to reserve for the container.
jobRole?๐Ÿ”นIRoleThe role that the container can assume.
linuxParameters?๐Ÿ”นLinuxParametersLinux-specific modifications that are applied to the container, such as details for device mappings.
logging?๐Ÿ”นLogDriverThe loging configuration for this Job.
privileged?๐Ÿ”นbooleanWhen this parameter is true, the container is given elevated permissions on the host container instance (similar to the root user).
readonlyRootFilesystem?๐Ÿ”นbooleanGives the container readonly access to its root filesystem.
secrets?๐Ÿ”น{ [string]: ISecret }A map from environment variable names to the secrets for the container.
ulimits?๐Ÿ”นUlimit[]Limits to set for the user this docker container will run as.
user?๐Ÿ”นstringThe user name to use inside the container.
volumes?๐Ÿ”นEcsVolume[]The volumes to mount to this container.

cpu๐Ÿ”น

Type: number

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.


image๐Ÿ”น

Type: ContainerImage

The image that this container will run.


memory๐Ÿ”น

Type: Size

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.


command?๐Ÿ”น

Type: string[] (optional, default: no command)

The command that's passed to the container.

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


environment?๐Ÿ”น

Type: { [string]: string } (optional, default: no environment variables)

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.


executionRole?๐Ÿ”น

Type: IRole (optional, default: a Role will be created)

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

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


gpu?๐Ÿ”น

Type: number (optional, default: no gpus)

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.


jobRole?๐Ÿ”น

Type: IRole (optional, default: no job role)

The role that the container can assume.

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


linuxParameters?๐Ÿ”น

Type: LinuxParameters (optional, default: none)

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


logging?๐Ÿ”น

Type: LogDriver (optional, default: the log configuration of the Docker daemon)

The loging configuration for this Job.


privileged?๐Ÿ”น

Type: boolean (optional, default: false)

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


readonlyRootFilesystem?๐Ÿ”น

Type: boolean (optional, default: false)

Gives the container readonly access to its root filesystem.


secrets?๐Ÿ”น

Type: { [string]: ISecret } (optional, default: no 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.

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


ulimits?๐Ÿ”น

Type: Ulimit[] (optional, default: no ulimits)

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


user?๐Ÿ”น

Type: string (optional, default: no user)

The user name to use inside the container.


volumes?๐Ÿ”น

Type: EcsVolume[] (optional, default: no volumes)

The volumes to mount to this container.

Automatically added to the job definition.