Interface IEcsTaskProps
Properties to define an ECS Event Task.
Inherited Members
Namespace: Amazon.CDK.AWS.Events.Targets
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IEcsTaskProps : ITargetBaseProps
Syntax (vb)
Public Interface IEcsTaskProps
Inherits ITargetBaseProps
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.ECS;
using Amazon.CDK.AWS.EC2;
ICluster cluster;
TaskDefinition taskDefinition;
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Hours(1))
});
rule.AddTarget(
new EcsTask(new EcsTaskProps {
Cluster = cluster,
TaskDefinition = taskDefinition,
AssignPublicIp = true,
SubnetSelection = new SubnetSelection { SubnetType = SubnetType.PUBLIC }
}));
Synopsis
Properties
AssignPublicIp | Specifies whether the task's elastic network interface receives a public IP address. |
Cluster | Cluster where service will be deployed. |
ContainerOverrides | Container setting overrides. |
EnableExecuteCommand | Whether or not to enable the execute command functionality for the containers in this task. |
LaunchType | Specifies the launch type on which your task is running. |
PlatformVersion | The platform version on which to run your task. |
PropagateTags | Specifies whether to propagate the tags from the task definition to the task. |
Role | Existing IAM role to run the ECS task. |
SecurityGroups | Existing security groups to use for the task's ENIs. |
SubnetSelection | In what subnets to place the task's ENIs. |
Tags | The metadata that you apply to the task to help you categorize and organize them. |
TaskCount | How many tasks should be started when this event is triggered. |
TaskDefinition | Task Definition of the task that should be started. |
Properties
AssignPublicIp
Specifies whether the task's elastic network interface receives a public IP address.
virtual Nullable<bool> AssignPublicIp { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
You can specify true only when LaunchType is set to FARGATE.
Default: - true if the subnet type is PUBLIC, otherwise false
Cluster
ContainerOverrides
Container setting overrides.
virtual IContainerOverride[] ContainerOverrides { get; }
Property Value
Remarks
Key is the name of the container to override, value is the values you want to override.
EnableExecuteCommand
Whether or not to enable the execute command functionality for the containers in this task.
virtual Nullable<bool> EnableExecuteCommand { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
If true, this enables execute command functionality on all containers in the task.
Default: - false
LaunchType
Specifies the launch type on which your task is running.
virtual Nullable<LaunchType> LaunchType { get; }
Property Value
System.Nullable<LaunchType>
Remarks
The launch type that you specify here must match one of the launch type (compatibilities) of the target task.
Default: - 'EC2' if isEc2Compatible
for the taskDefinition
is true, otherwise 'FARGATE'
PlatformVersion
The platform version on which to run your task.
virtual Nullable<FargatePlatformVersion> PlatformVersion { get; }
Property Value
System.Nullable<FargatePlatformVersion>
Remarks
Unless you have specific compatibility requirements, you don't need to specify this.
Default: - ECS will set the Fargate platform version to 'LATEST'
See: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html
PropagateTags
Specifies whether to propagate the tags from the task definition to the task.
virtual Nullable<PropagatedTagSource> PropagateTags { get; }
Property Value
System.Nullable<PropagatedTagSource>
Remarks
If no value is specified, the tags are not propagated.
Default: - Tags will not be propagated
Role
Existing IAM role to run the ECS task.
virtual IRole Role { get; }
Property Value
Remarks
Default: A new IAM role is created
SecurityGroups
Existing security groups to use for the task's ENIs.
virtual ISecurityGroup[] SecurityGroups { get; }
Property Value
Remarks
(Only applicable in case the TaskDefinition is configured for AwsVpc networking)
Default: A new security group is created
SubnetSelection
In what subnets to place the task's ENIs.
virtual ISubnetSelection SubnetSelection { get; }
Property Value
Remarks
(Only applicable in case the TaskDefinition is configured for AwsVpc networking)
Default: Private subnets
Tags
The metadata that you apply to the task to help you categorize and organize them.
virtual ITag[] Tags { get; }
Property Value
ITag[]
Remarks
Each tag consists of a key and an optional value, both of which you define.
Default: - No additional tags are applied to the task
TaskCount
How many tasks should be started when this event is triggered.
virtual Nullable<double> TaskCount { get; }
Property Value
System.Nullable<System.Double>
Remarks
Default: 1
TaskDefinition
Task Definition of the task that should be started.
ITaskDefinition TaskDefinition { get; }
Property Value