Interface IEcsRunTaskProps
Properties for ECS Tasks.
Inherited Members
Namespace: Amazon.CDK.AWS.StepFunctions.Tasks
Assembly: Amazon.CDK.AWS.StepFunctions.Tasks.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, "Ec2Cluster", new ClusterProps { Vpc = vpc });
cluster.AddCapacity("DefaultAutoScalingGroup", new AddCapacityOptions {
InstanceType = new InstanceType("t2.micro"),
VpcSubnets = new SubnetSelection { SubnetType = SubnetType.PUBLIC }
});
var taskDefinition = new TaskDefinition(this, "TD", new TaskDefinitionProps {
Compatibility = Compatibility.EC2
});
taskDefinition.AddContainer("TheContainer", new ContainerDefinitionOptions {
Image = ContainerImage.FromRegistry("foo/bar"),
MemoryLimitMiB = 256
});
var runTask = new EcsRunTask(this, "Run", new EcsRunTaskProps {
IntegrationPattern = IntegrationPattern.RUN_JOB,
Cluster = cluster,
TaskDefinition = taskDefinition,
LaunchTarget = new EcsEc2LaunchTarget(new EcsEc2LaunchTargetOptions {
PlacementStrategies = new [] { PlacementStrategy.SpreadAcrossInstances(), PlacementStrategy.PackedByCpu(), PlacementStrategy.Randomly() },
PlacementConstraints = new [] { PlacementConstraint.MemberOf("blieptuut") }
})
});
Synopsis
Properties
AssignPublicIp | Assign public IP addresses to each task. |
Cluster | The ECS cluster to run the task on. |
ContainerOverrides | Container setting overrides. |
LaunchTarget | An Amazon ECS launch type determines the type of infrastructure on which your tasks and services are hosted. |
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
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
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