EcsEc2ContainerDefinitionProps Struct
Props to configure an EcsEc2ContainerDefinition.
Example
declare const myFileSystem: efs.IFileSystem;
declare const myJobRole: iam.Role;
myFileSystem.grantRead(myJobRole);
const jobDefn = new batch.EcsJobDefinition(this, 'JobDefn', {
container: new batch.EcsEc2ContainerDefinition(this, 'containerDefn', {
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
memory: cdk.Size.mebibytes(2048),
cpu: 256,
volumes: [batch.EcsVolume.efs({
name: 'myVolume',
fileSystem: myFileSystem,
containerPath: '/Volumes/myVolume',
useJobRole: true,
})],
jobRole: myJobRole,
}),
});
Properties
commandstring[]commandtyping.List[str]commandList<String>Commandstring[]Command*[]*string= no command#Each vCPU is equivalent to 1,024 CPU shares. For containers running on EC2 resources, you must specify at least one vCPU.
enableExecuteCommandbooleanenable_execute_commandboolenableExecuteCommandBooleanEnableExecuteCommandboolEnableExecuteCommand*bool= undefined - AWS Batch default is…#notes · default
If true, execute command functionality is turned on all the containers in the task.
This allows you to use ECS Exec to access containers interactively. When enabled, a job role with required SSM permissions will be created automatically if no job role is provided. If a job role is alreadyprovided, the required permissions will be added to it.
Default: undefined - AWS Batch default is false
environment{ [key: string]: string }environmenttyping.Mapping[str, str]environmentMap<String, String>EnvironmentIDictionary<string, string>Environment*map[string]*string= no environment variables#Cannot start with AWS_BATCH. We don't recommend using plaintext environment variables for sensitive information, such as credential data.
executionRoleIRoleexecution_roleIRoleexecutionRoleIRoleExecutionRoleIRoleExecutionRoleIRole= a Role will be created#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.
imageContainerImageimageContainerImageimageContainerImageImageContainerImageImageContainerImagerequired#linuxParametersLinuxParameterslinux_parametersLinuxParameterslinuxParametersLinuxParametersLinuxParametersLinuxParametersLinuxParametersLinuxParameters= none#loggingLogDriverloggingLogDriverloggingLogDriverLoggingLogDriverLoggingLogDriver= the log configuration of the Doc…#default
Default: the log configuration of the Docker daemon
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.
readonlyRootFilesystembooleanreadonly_root_filesystemboolreadonlyRootFilesystemBooleanReadonlyRootFilesystemboolReadonlyRootFilesystem*bool= false#secrets{ [key: string]: Secret }secretstyping.Mapping[str, Secret]secretsMap<String, Secret>SecretsIDictionary<string, Secret>Secrets*map[string]Secret= no secrets#Allows your job definitions to reference the secret by the environment variable name defined in this property.
ulimitsUlimit[]ulimitstyping.List[Ulimit]ulimitsList<Ulimit>UlimitsUlimit[]Ulimits*[]Ulimit= no ulimits#