Class CfnJobDefinition.ContainerPropertiesProperty
Container properties are used for Amazon ECS based job definitions.
Inheritance
Namespace: Amazon.CDK.AWS.Batch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ContainerPropertiesProperty : Object, CfnJobDefinition.IContainerPropertiesProperty
Syntax (vb)
Public Class ContainerPropertiesProperty
Inherits Object
Implements 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" },
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
Constructors
ContainerPropertiesProperty() |
Properties
Command | The command that's passed to the container. |
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 | The instance type to use for a multi-node parallel job. |
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. |
Constructors
ContainerPropertiesProperty()
public ContainerPropertiesProperty()
Properties
Command
The command that's passed to the container.
public string[] Command { get; set; }
Property Value
System.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 .
Environment
The environment variables to pass to a container.
public object Environment { get; set; }
Property Value
System.Object
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 " AWS_BATCH
". This naming convention is reserved for variables that AWS Batch sets.
EphemeralStorage
The amount of ephemeral storage to allocate for the task.
public object EphemeralStorage { get; set; }
Property Value
System.Object
Remarks
This parameter is used to expand the total amount of ephemeral storage available, beyond the default amount, for tasks hosted on AWS Fargate .
ExecutionRoleArn
The Amazon Resource Name (ARN) of the execution role that AWS Batch can assume.
public string ExecutionRoleArn { get; set; }
Property Value
System.String
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.
public object FargatePlatformConfiguration { get; set; }
Property Value
System.Object
Remarks
Jobs that are running on Amazon EC2 resources must not specify this parameter.
Image
Required.
public string Image { get; set; }
Property Value
System.String
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
The instance type to use for a multi-node parallel job.
public string InstanceType { get; set; }
Property Value
System.String
Remarks
All node groups in a multi-node parallel job must use the same instance type.
This parameter isn't applicable to single-node container jobs or jobs that run on Fargate resources, and shouldn't be provided.
JobRoleArn
The Amazon Resource Name (ARN) of the IAM role that the container can assume for AWS permissions.
public string JobRoleArn { get; set; }
Property Value
System.String
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.
public object LinuxParameters { get; set; }
Property Value
System.Object
Remarks
LogConfiguration
The log configuration specification for the container.
public object LogConfiguration { get; set; }
Property Value
System.Object
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 LogConfiguration 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 ECS_AVAILABLE_LOGGING_DRIVERS
environment variable before containers placed on that instance can use these log configuration options. For more information, see Amazon ECS container agent configuration in the Amazon Elastic Container Service Developer Guide .
Memory
This parameter is deprecated, use resourceRequirements
to specify the memory requirements for the job definition.
public Nullable<double> Memory { get; set; }
Property Value
System.Nullable<System.Double>
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.
public object MountPoints { get; set; }
Property Value
System.Object
Remarks
This parameter maps to Volumes
in the Create a container section of the Docker Remote API and the --volume
option to docker run .
NetworkConfiguration
The network configuration for jobs that are running on Fargate resources.
public object NetworkConfiguration { get; set; }
Property Value
System.Object
Remarks
Jobs that are running on Amazon EC2 resources must not specify this parameter.
Privileged
When this parameter is true, the container is given elevated permissions on the host container instance (similar to the root
user).
public object Privileged { get; set; }
Property Value
System.Object
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.
ReadonlyRootFilesystem
When this parameter is true, the container is given read-only access to its root file system.
public object ReadonlyRootFilesystem { get; set; }
Property Value
System.Object
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
.
RepositoryCredentials
The private repository authentication credentials to use.
public object RepositoryCredentials { get; set; }
Property Value
System.Object
Remarks
ResourceRequirements
The type and amount of resources to assign to a container.
public object ResourceRequirements { get; set; }
Property Value
System.Object
Remarks
The supported resources include GPU
, MEMORY
, and VCPU
.
RuntimePlatform
An object that represents the compute environment architecture for AWS Batch jobs on Fargate.
public object RuntimePlatform { get; set; }
Property Value
System.Object
Remarks
Secrets
The secrets for the container.
public object Secrets { get; set; }
Property Value
System.Object
Remarks
For more information, see Specifying sensitive data in the AWS Batch User Guide .
Ulimits
A list of ulimits
to set in the container.
public object Ulimits { get; set; }
Property Value
System.Object
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.
User
The user name to use inside the container.
public string User { get; set; }
Property Value
System.String
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.
public Nullable<double> Vcpus { get; set; }
Property Value
System.Nullable<System.Double>
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.
public object Volumes { get; set; }
Property Value
System.Object