Interface IEc2TaskDefinitionProps
The properties for a task definition run on an EC2 cluster.
Inherited Members
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public interface IEc2TaskDefinitionProps : ICommonTaskDefinitionProps
Syntax (vb)
Public Interface IEc2TaskDefinitionProps
Inherits ICommonTaskDefinitionProps
Remarks
ExampleMetadata: infused
Examples
var ec2TaskDefinition = new Ec2TaskDefinition(this, "TaskDef", new Ec2TaskDefinitionProps {
NetworkMode = NetworkMode.BRIDGE
});
var container = ec2TaskDefinition.AddContainer("WebContainer", new ContainerDefinitionOptions {
// Use an image from DockerHub
Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample"),
MemoryLimitMiB = 1024
});
Synopsis
Properties
InferenceAccelerators | The inference accelerators to use for the containers in the task. |
IpcMode | The IPC resource namespace to use for the containers in the task. |
NetworkMode | The Docker networking mode to use for the containers in the task. |
PidMode | The process namespace to use for the containers in the task. |
PlacementConstraints | An array of placement constraint objects to use for the task. |
Properties
InferenceAccelerators
The inference accelerators to use for the containers in the task.
virtual IInferenceAccelerator[] InferenceAccelerators { get; }
Property Value
Remarks
Not supported in Fargate.
Default: - No inference accelerators.
IpcMode
The IPC resource namespace to use for the containers in the task.
virtual Nullable<IpcMode> IpcMode { get; }
Property Value
System.Nullable<IpcMode>
Remarks
Not supported in Fargate and Windows containers.
Default: - IpcMode used by the task is not specified
NetworkMode
The Docker networking mode to use for the containers in the task.
virtual Nullable<NetworkMode> NetworkMode { get; }
Property Value
System.Nullable<NetworkMode>
Remarks
The valid values are NONE, BRIDGE, AWS_VPC, and HOST.
Default: - NetworkMode.BRIDGE for EC2 tasks, AWS_VPC for Fargate tasks.
PidMode
The process namespace to use for the containers in the task.
virtual Nullable<PidMode> PidMode { get; }
Property Value
System.Nullable<PidMode>
Remarks
Not supported in Fargate and Windows containers.
Default: - PidMode used by the task is not specified
PlacementConstraints
An array of placement constraint objects to use for the task.
virtual PlacementConstraint[] PlacementConstraints { get; }
Property Value
Remarks
You can specify a maximum of 10 constraints per task (this limit includes constraints in the task definition and those specified at run time).
Default: - No placement constraints.