Interface IEcsRunTaskProps
Properties for ECS Tasks.
Inherited Members
Namespace: Amazon.CDK.AWS.StepFunctions.Tasks
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IEcsRunTaskProps : ITaskStateBaseProps
Syntax (vb)
Public Interface IEcsRunTaskProps
Inherits ITaskStateBaseProps
Remarks
ExampleMetadata: infused
Examples
var vpc = Vpc.FromLookup(this, "Vpc", new VpcLookupOptions {
IsDefault = true
});
var cluster = new Cluster(this, "FargateCluster", new ClusterProps { Vpc = vpc });
var taskDefinition = new TaskDefinition(this, "TD", new TaskDefinitionProps {
MemoryMiB = "512",
Cpu = "256",
Compatibility = Compatibility.FARGATE
});
var containerDefinition = taskDefinition.AddContainer("TheContainer", new ContainerDefinitionOptions {
Image = ContainerImage.FromRegistry("foo/bar"),
MemoryLimitMiB = 256
});
var runTask = new EcsRunTask(this, "RunFargate", new EcsRunTaskProps {
IntegrationPattern = IntegrationPattern.RUN_JOB,
Cluster = cluster,
TaskDefinition = taskDefinition,
AssignPublicIp = true,
ContainerOverrides = new [] { new ContainerOverride {
ContainerDefinition = containerDefinition,
Environment = new [] { new TaskEnvironmentVariable { Name = "SOME_KEY", Value = JsonPath.StringAt("$.SomeKey") } }
} },
LaunchTarget = new EcsFargateLaunchTarget(),
PropagatedTagSource = PropagatedTagSource.TASK_DEFINITION
});
Synopsis
Properties
AssignPublicIp | Assign public IP addresses to each task. |
Cluster | The ECS cluster to run the task on. |
ContainerOverrides | Container setting overrides. |
Cpu | Cpu setting override. |
EnableExecuteCommand | Whether ECS Exec should be enabled. |
LaunchTarget | An Amazon ECS launch type determines the type of infrastructure on which your tasks and services are hosted. |
MemoryMiB | Memory setting override. |
PropagatedTagSource | Specifies whether to propagate the tags from the task definition to the task. |
RevisionNumber | The revision number of ECS task definition family. |
SecurityGroups | Existing security groups to use for the tasks. |
Subnets | Subnets to place the task's ENIs. |
TaskDefinition | [disable-awslint:ref-via-interface] Task Definition used for running tasks in the service. |
Properties
AssignPublicIp
Assign public IP addresses to each task.
virtual Nullable<bool> AssignPublicIp { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
Cluster
ContainerOverrides
Container setting overrides.
virtual IContainerOverride[] ContainerOverrides { get; }
Property Value
Remarks
Specify the container to use and the overrides to apply.
Default: - No overrides
Cpu
Cpu setting override.
virtual string Cpu { get; }
Property Value
System.String
Remarks
Default: - No override
See: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TaskOverride.html
EnableExecuteCommand
Whether ECS Exec should be enabled.
virtual Nullable<bool> EnableExecuteCommand { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
LaunchTarget
An Amazon ECS launch type determines the type of infrastructure on which your tasks and services are hosted.
IEcsLaunchTarget LaunchTarget { get; }
Property Value
Remarks
MemoryMiB
Memory setting override.
virtual string MemoryMiB { get; }
Property Value
System.String
Remarks
Default: - No override
See: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TaskOverride.html
PropagatedTagSource
Specifies whether to propagate the tags from the task definition to the task.
virtual Nullable<PropagatedTagSource> PropagatedTagSource { get; }
Property Value
System.Nullable<PropagatedTagSource>
Remarks
An error will be received if you specify the SERVICE option when running a task.
Default: - No tags are propagated.
RevisionNumber
The revision number of ECS task definition family.
virtual Nullable<double> RevisionNumber { get; }
Property Value
System.Nullable<System.Double>
Remarks
Default: - '$latest'
SecurityGroups
Existing security groups to use for the tasks.
virtual ISecurityGroup[] SecurityGroups { get; }
Property Value
Remarks
Default: - A new security group is created
Subnets
Subnets to place the task's ENIs.
virtual ISubnetSelection Subnets { get; }
Property Value
Remarks
Default: - Public subnets if assignPublicIp is set. Private subnets otherwise.
TaskDefinition
[disable-awslint:ref-via-interface] Task Definition used for running tasks in the service.
TaskDefinition TaskDefinition { get; }
Property Value
Remarks
Note: this must be TaskDefinition, and not ITaskDefinition, as it requires properties that are not known for imported task definitions If you want to run a RunTask with an imported task definition, consider using CustomState