Class EcsRunTaskProps
Properties for ECS Tasks.
Inheritance
Namespace: Amazon.CDK.AWS.StepFunctions.Tasks
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class EcsRunTaskProps : Object, IEcsRunTaskProps, ITaskStateBaseProps
Syntax (vb)
Public Class EcsRunTaskProps
Inherits Object
Implements IEcsRunTaskProps, 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
Constructors
EcsRunTaskProps() |
Properties
AssignPublicIp | Assign public IP addresses to each task. |
Cluster | The ECS cluster to run the task on. |
Comment | An optional description for this state. |
ContainerOverrides | Container setting overrides. |
Credentials | Credentials for an IAM Role that the State Machine assumes for executing the task. |
EnableExecuteCommand | Whether ECS Exec should be enabled. |
Heartbeat | (deprecated) Timeout for the heartbeat. |
HeartbeatTimeout | Timeout for the heartbeat. |
InputPath | JSONPath expression to select part of the state to be the input to this state. |
IntegrationPattern | AWS Step Functions integrates with services directly in the Amazon States Language. |
LaunchTarget | An Amazon ECS launch type determines the type of infrastructure on which your tasks and services are hosted. |
OutputPath | JSONPath expression to select select a portion of the state output to pass to the next state. |
PropagatedTagSource | Specifies whether to propagate the tags from the task definition to the task. |
ResultPath | JSONPath expression to indicate where to inject the state's output. |
ResultSelector | The JSON that will replace the state's raw result and become the effective result before ResultPath is applied. |
RevisionNumber | The revision number of ECS task definition family. |
SecurityGroups | Existing security groups to use for the tasks. |
StateName | Optional name for this state. |
Subnets | Subnets to place the task's ENIs. |
TaskDefinition | [disable-awslint:ref-via-interface] Task Definition used for running tasks in the service. |
TaskTimeout | Timeout for the task. |
Timeout | (deprecated) Timeout for the task. |
Constructors
EcsRunTaskProps()
public EcsRunTaskProps()
Properties
AssignPublicIp
Assign public IP addresses to each task.
public Nullable<bool> AssignPublicIp { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
Cluster
Comment
An optional description for this state.
public string Comment { get; set; }
Property Value
System.String
Remarks
Default: - No comment
ContainerOverrides
Container setting overrides.
public IContainerOverride[] ContainerOverrides { get; set; }
Property Value
Remarks
Specify the container to use and the overrides to apply.
Default: - No overrides
Credentials
Credentials for an IAM Role that the State Machine assumes for executing the task.
public ICredentials Credentials { get; set; }
Property Value
Remarks
This enables cross-account resource invocations.
Default: - None (Task is executed using the State Machine's execution role)
See: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-access-cross-acct-resources.html
EnableExecuteCommand
Whether ECS Exec should be enabled.
public Nullable<bool> EnableExecuteCommand { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Heartbeat
(deprecated) Timeout for the heartbeat.
public Duration Heartbeat { get; set; }
Property Value
Remarks
Default: - None
Stability: Deprecated
HeartbeatTimeout
Timeout for the heartbeat.
public Timeout HeartbeatTimeout { get; set; }
Property Value
Remarks
[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface
Default: - None
InputPath
JSONPath expression to select part of the state to be the input to this state.
public string InputPath { get; set; }
Property Value
System.String
Remarks
May also be the special value JsonPath.DISCARD, which will cause the effective input to be the empty object {}.
Default: - The entire task input (JSON path '$')
IntegrationPattern
AWS Step Functions integrates with services directly in the Amazon States Language.
public Nullable<IntegrationPattern> IntegrationPattern { get; set; }
Property Value
System.Nullable<IntegrationPattern>
Remarks
You can control these AWS services using service integration patterns.
Depending on the AWS Service, the Service Integration Pattern availability will vary.
Default: - IntegrationPattern.REQUEST_RESPONSE
for most tasks.
IntegrationPattern.RUN_JOB
for the following exceptions:
BatchSubmitJob
, EmrAddStep
, EmrCreateCluster
, EmrTerminationCluster
, and EmrContainersStartJobRun
.
See: https://docs.aws.amazon.com/step-functions/latest/dg/connect-supported-services.html
LaunchTarget
An Amazon ECS launch type determines the type of infrastructure on which your tasks and services are hosted.
public IEcsLaunchTarget LaunchTarget { get; set; }
Property Value
Remarks
OutputPath
JSONPath expression to select select a portion of the state output to pass to the next state.
public string OutputPath { get; set; }
Property Value
System.String
Remarks
May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}.
Default: - The entire JSON node determined by the state input, the task result, and resultPath is passed to the next state (JSON path '$')
PropagatedTagSource
Specifies whether to propagate the tags from the task definition to the task.
public Nullable<PropagatedTagSource> PropagatedTagSource { get; set; }
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.
ResultPath
JSONPath expression to indicate where to inject the state's output.
public string ResultPath { get; set; }
Property Value
System.String
Remarks
May also be the special value JsonPath.DISCARD, which will cause the state's input to become its output.
Default: - Replaces the entire input with the result (JSON path '$')
ResultSelector
The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.
public IDictionary<string, object> ResultSelector { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Remarks
You can use ResultSelector to create a payload with values that are static or selected from the state's raw result.
Default: - None
RevisionNumber
The revision number of ECS task definition family.
public Nullable<double> RevisionNumber { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Default: - '$latest'
SecurityGroups
Existing security groups to use for the tasks.
public ISecurityGroup[] SecurityGroups { get; set; }
Property Value
Remarks
Default: - A new security group is created
StateName
Optional name for this state.
public string StateName { get; set; }
Property Value
System.String
Remarks
Default: - The construct ID will be used as state name
Subnets
Subnets to place the task's ENIs.
public ISubnetSelection Subnets { get; set; }
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.
public TaskDefinition TaskDefinition { get; set; }
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
TaskTimeout
Timeout for the task.
public Timeout TaskTimeout { get; set; }
Property Value
Remarks
[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface
Default: - None
Timeout
(deprecated) Timeout for the task.
public Duration Timeout { get; set; }
Property Value
Remarks
Default: - None
Stability: Deprecated