Class Ec2TaskDefinitionProps
The properties for a task definition run on an EC2 cluster.
Inheritance
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Ec2TaskDefinitionProps : Object, IEc2TaskDefinitionProps, ICommonTaskDefinitionProps
Syntax (vb)
Public Class Ec2TaskDefinitionProps
Inherits Object
Implements IEc2TaskDefinitionProps, 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
Constructors
Ec2TaskDefinitionProps() |
Properties
ExecutionRole | The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf. |
Family | The name of a family that this task definition is registered to. |
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. |
ProxyConfiguration | The configuration details for the App Mesh proxy. |
TaskRole | The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf. |
Volumes | The list of volume definitions for the task. |
Constructors
Ec2TaskDefinitionProps()
public Ec2TaskDefinitionProps()
Properties
ExecutionRole
The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf.
public IRole ExecutionRole { get; set; }
Property Value
Remarks
The role will be used to retrieve container images from ECR and create CloudWatch log groups.
Default: - An execution role will be automatically created if you use ECR images in your task definition.
Family
The name of a family that this task definition is registered to.
public string Family { get; set; }
Property Value
System.String
Remarks
A family groups multiple versions of a task definition.
Default: - Automatically generated name.
InferenceAccelerators
The inference accelerators to use for the containers in the task.
public IInferenceAccelerator[] InferenceAccelerators { get; set; }
Property Value
Remarks
Not supported in Fargate.
Default: - No inference accelerators.
IpcMode
The IPC resource namespace to use for the containers in the task.
public Nullable<IpcMode> IpcMode { get; set; }
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.
public Nullable<NetworkMode> NetworkMode { get; set; }
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.
public Nullable<PidMode> PidMode { get; set; }
Property Value
System.Nullable<PidMode>
Remarks
Not supported in Windows containers.
Default: - PidMode used by the task is not specified
PlacementConstraints
An array of placement constraint objects to use for the task.
public PlacementConstraint[] PlacementConstraints { get; set; }
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.
ProxyConfiguration
The configuration details for the App Mesh proxy.
public ProxyConfiguration ProxyConfiguration { get; set; }
Property Value
Remarks
Default: - No proxy configuration.
TaskRole
The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
public IRole TaskRole { get; set; }
Property Value
Remarks
Default: - A task role is automatically created for you.
Volumes
The list of volume definitions for the task.
public IVolume[] Volumes { get; set; }
Property Value
IVolume[]
Remarks
For more information, see Task Definition Parameter Volumes.
Default: - No volumes are passed to the Docker daemon on a container instance.