Interface CfnJobDefinition.IContainerPropertiesProperty
Container properties are used for Amazon ECS based job definitions.
Namespace: Amazon.CDK.AWS.Batch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface CfnJobDefinition.IContainerPropertiesProperty
Syntax (vb)
Public Interface CfnJobDefinition.IContainerPropertiesProperty
Remarks
These properties to describe the container that's launched as part of a job.
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Batch;
var options;
var containerPropertiesProperty = new ContainerPropertiesProperty {
Image = "image",
// the properties below are optional
Command = new [] { "command" },
EnableExecuteCommand = false,
Environment = new [] { new EnvironmentProperty {
Name = "name",
Value = "value"
} },
EphemeralStorage = new EphemeralStorageProperty {
SizeInGiB = 123
},
ExecutionRoleArn = "executionRoleArn",
FargatePlatformConfiguration = new FargatePlatformConfigurationProperty {
PlatformVersion = "platformVersion"
},
InstanceType = "instanceType",
JobRoleArn = "jobRoleArn",
LinuxParameters = new LinuxParametersProperty {
Devices = new [] { new DeviceProperty {
ContainerPath = "containerPath",
HostPath = "hostPath",
Permissions = new [] { "permissions" }
} },
InitProcessEnabled = false,
MaxSwap = 123,
SharedMemorySize = 123,
Swappiness = 123,
Tmpfs = new [] { new TmpfsProperty {
ContainerPath = "containerPath",
Size = 123,
// the properties below are optional
MountOptions = new [] { "mountOptions" }
} }
},
LogConfiguration = new LogConfigurationProperty {
LogDriver = "logDriver",
// the properties below are optional
Options = options,
SecretOptions = new [] { new SecretProperty {
Name = "name",
ValueFrom = "valueFrom"
} }
},
Memory = 123,
MountPoints = new [] { new MountPointsProperty {
ContainerPath = "containerPath",
ReadOnly = false,
SourceVolume = "sourceVolume"
} },
NetworkConfiguration = new NetworkConfigurationProperty {
AssignPublicIp = "assignPublicIp"
},
Privileged = false,
ReadonlyRootFilesystem = false,
RepositoryCredentials = new RepositoryCredentialsProperty {
CredentialsParameter = "credentialsParameter"
},
ResourceRequirements = new [] { new ResourceRequirementProperty {
Type = "type",
Value = "value"
} },
RuntimePlatform = new RuntimePlatformProperty {
CpuArchitecture = "cpuArchitecture",
OperatingSystemFamily = "operatingSystemFamily"
},
Secrets = new [] { new SecretProperty {
Name = "name",
ValueFrom = "valueFrom"
} },
Ulimits = new [] { new UlimitProperty {
HardLimit = 123,
Name = "name",
SoftLimit = 123
} },
User = "user",
Vcpus = 123,
Volumes = new [] { new VolumesProperty {
EfsVolumeConfiguration = new EfsVolumeConfigurationProperty {
FileSystemId = "fileSystemId",
// the properties below are optional
AuthorizationConfig = new AuthorizationConfigProperty {
AccessPointId = "accessPointId",
Iam = "iam"
},
RootDirectory = "rootDirectory",
TransitEncryption = "transitEncryption",
TransitEncryptionPort = 123
},
Host = new VolumesHostProperty {
SourcePath = "sourcePath"
},
Name = "name"
} }
};
Synopsis
Properties
| Command | The command that's passed to the container. |
| EnableExecuteCommand | Determines whether execute command functionality is turned on for this task. |
| Environment | The environment variables to pass to a container. |
| EphemeralStorage | The amount of ephemeral storage to allocate for the task. |
| ExecutionRoleArn | The Amazon Resource Name (ARN) of the execution role that AWS Batch can assume. |
| FargatePlatformConfiguration | The platform configuration for jobs that are running on Fargate resources. |
| Image | Required. |
| InstanceType | Container properties are used for Amazon ECS based job definitions. |
| JobRoleArn | The Amazon Resource Name (ARN) of the IAM role that the container can assume for AWS permissions. |
| LinuxParameters | Linux-specific modifications that are applied to the container, such as details for device mappings. |
| LogConfiguration | The log configuration specification for the container. |
| Memory | This parameter is deprecated, use |
| MountPoints | The mount points for data volumes in your container. |
| NetworkConfiguration | The network configuration for jobs that are running on Fargate resources. |
| Privileged | When this parameter is true, the container is given elevated permissions on the host container instance (similar to the |
| ReadonlyRootFilesystem | When this parameter is true, the container is given read-only access to its root file system. |
| RepositoryCredentials | The private repository authentication credentials to use. |
| ResourceRequirements | The type and amount of resources to assign to a container. |
| RuntimePlatform | An object that represents the compute environment architecture for AWS Batch jobs on Fargate. |
| Secrets | The secrets for the container. |
| Ulimits | A list of |
| User | The user name to use inside the container. |
| Vcpus | This parameter is deprecated, use |
| Volumes | A list of data volumes used in a job. |
Properties
Command
The command that's passed to the container.
string[]? Command { get; }
Property Value
string[]
Remarks
This parameter maps to Cmd in the Create a container section of the Docker Remote API and the COMMAND parameter to docker run . For more information, see https://docs.docker.com/engine/reference/builder/#cmd .
EnableExecuteCommand
Determines whether execute command functionality is turned on for this task.
object? EnableExecuteCommand { get; }
Property Value
Remarks
If true , execute command functionality is turned on all the containers in the task.
Type union: either bool or IResolvable
Environment
The environment variables to pass to a container.
object? Environment { get; }
Property Value
Remarks
This parameter maps to Env in the Create a container section of the Docker Remote API and the --env option to docker run .
We don't recommend using plaintext environment variables for sensitive information, such as credential data. > Environment variables cannot start with " <code>AWS_BATCH</code> ". This naming convention is reserved for variables that AWS Batch sets.
Type union: either IResolvable or (either IResolvable or CfnJobDefinition.IEnvironmentProperty)[]
EphemeralStorage
The amount of ephemeral storage to allocate for the task.
object? EphemeralStorage { get; }
Property Value
Remarks
This parameter is used to expand the total amount of ephemeral storage available, beyond the default amount, for tasks hosted on AWS Fargate .
Type union: either IResolvable or CfnJobDefinition.IEphemeralStorageProperty
ExecutionRoleArn
The Amazon Resource Name (ARN) of the execution role that AWS Batch can assume.
string? ExecutionRoleArn { get; }
Property Value
Remarks
For jobs that run on Fargate resources, you must provide an execution role. For more information, see AWS Batch execution IAM role in the AWS Batch User Guide .
FargatePlatformConfiguration
The platform configuration for jobs that are running on Fargate resources.
object? FargatePlatformConfiguration { get; }
Property Value
Remarks
Jobs that are running on Amazon EC2 resources must not specify this parameter.
Type union: either IResolvable or CfnJobDefinition.IFargatePlatformConfigurationProperty
Image
Required.
string Image { get; }
Property Value
Remarks
The image used to start a container. This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with repository-url / image : tag . It can be 255 characters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), underscores (_), colons (:), periods (.), forward slashes (/), and number signs (#). This parameter maps to Image in the Create a container section of the Docker Remote API and the IMAGE parameter of docker run .
Docker image architecture must match the processor architecture of the compute resources that they're scheduled on. For example, ARM-based Docker images can only run on ARM-based compute resources.
InstanceType
Container properties are used for Amazon ECS based job definitions.
string? InstanceType { get; }
Property Value
Remarks
JobRoleArn
The Amazon Resource Name (ARN) of the IAM role that the container can assume for AWS permissions.
string? JobRoleArn { get; }
Property Value
Remarks
For more information, see IAM roles for tasks in the Amazon Elastic Container Service Developer Guide .
LinuxParameters
Linux-specific modifications that are applied to the container, such as details for device mappings.
object? LinuxParameters { get; }
Property Value
Remarks
LogConfiguration
The log configuration specification for the container.
object? LogConfiguration { get; }
Property Value
Remarks
This parameter maps to LogConfig in the Create a container section of the Docker Remote API and the --log-driver option to docker run . By default, containers use the same logging driver that the Docker daemon uses. However the container might use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information on the options for different supported log drivers, see Configure logging drivers in the Docker documentation.
AWS Batch currently supports a subset of the logging drivers available to the Docker daemon (shown in the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties-logconfiguration.html">LogConfiguration</a> data type).
This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version | grep "Server API version"
The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the <code>ECS_AVAILABLE_LOGGING_DRIVERS</code> environment variable before containers placed on that instance can use these log configuration options. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html">Amazon ECS container agent configuration</a> in the <em>Amazon Elastic Container Service Developer Guide</em> .
Type union: either IResolvable or CfnJobDefinition.ILogConfigurationProperty
Memory
This parameter is deprecated, use resourceRequirements to specify the memory requirements for the job definition.
double? Memory { get; }
Property Value
Remarks
It's not supported for jobs running on Fargate resources. For jobs that run on Amazon EC2 resources, it specifies the memory hard limit (in MiB) for a container. If your container attempts to exceed the specified number, it's terminated. You must specify at least 4 MiB of memory for a job using this parameter. The memory hard limit can be specified in several places. It must be specified for each node at least once.
MountPoints
The mount points for data volumes in your container.
object? MountPoints { get; }
Property Value
Remarks
This parameter maps to Volumes in the Create a container section of the Docker Remote API and the --volume option to docker run .
Type union: either IResolvable or (either IResolvable or CfnJobDefinition.IMountPointsProperty)[]
NetworkConfiguration
The network configuration for jobs that are running on Fargate resources.
object? NetworkConfiguration { get; }
Property Value
Remarks
Jobs that are running on Amazon EC2 resources must not specify this parameter.
Type union: either IResolvable or CfnJobDefinition.INetworkConfigurationProperty
Privileged
When this parameter is true, the container is given elevated permissions on the host container instance (similar to the root user).
object? Privileged { get; }
Property Value
Remarks
This parameter maps to Privileged in the Create a container section of the Docker Remote API and the --privileged option to docker run . The default value is false.
This parameter isn't applicable to jobs that are running on Fargate resources and shouldn't be provided, or specified as false.
Type union: either bool or IResolvable
ReadonlyRootFilesystem
When this parameter is true, the container is given read-only access to its root file system.
object? ReadonlyRootFilesystem { get; }
Property Value
Remarks
This parameter maps to ReadonlyRootfs in the Create a container section of the Docker Remote API and the --read-only option to docker run .
Type union: either bool or IResolvable
RepositoryCredentials
The private repository authentication credentials to use.
object? RepositoryCredentials { get; }
Property Value
Remarks
ResourceRequirements
The type and amount of resources to assign to a container.
object? ResourceRequirements { get; }
Property Value
Remarks
The supported resources include GPU , MEMORY , and VCPU .
Type union: either IResolvable or (either IResolvable or CfnJobDefinition.IResourceRequirementProperty)[]
RuntimePlatform
An object that represents the compute environment architecture for AWS Batch jobs on Fargate.
object? RuntimePlatform { get; }
Property Value
Remarks
Secrets
The secrets for the container.
object? Secrets { get; }
Property Value
Remarks
For more information, see Specifying sensitive data in the AWS Batch User Guide .
Type union: either IResolvable or (either IResolvable or CfnJobDefinition.ISecretProperty)[]
Ulimits
A list of ulimits to set in the container.
object? Ulimits { get; }
Property Value
Remarks
This parameter maps to Ulimits in the Create a container section of the Docker Remote API and the --ulimit option to docker run .
This parameter isn't applicable to jobs that are running on Fargate resources and shouldn't be provided.
Type union: either IResolvable or (either IResolvable or CfnJobDefinition.IUlimitProperty)[]
User
The user name to use inside the container.
string? User { get; }
Property Value
Remarks
This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run .
Vcpus
This parameter is deprecated, use resourceRequirements to specify the vCPU requirements for the job definition.
double? Vcpus { get; }
Property Value
Remarks
It's not supported for jobs running on Fargate resources. For jobs running on Amazon EC2 resources, it specifies the number of vCPUs reserved for the job.
Each vCPU is equivalent to 1,024 CPU shares. This parameter maps to CpuShares in the Create a container section of the Docker Remote API and the --cpu-shares option to docker run . The number of vCPUs must be specified but can be specified in several places. You must specify it at least once for each node.
Volumes
A list of data volumes used in a job.
object? Volumes { get; }