Show / Hide Table of Contents

Class EcsTask

Start a task on an ECS cluster.

Inheritance
object
EcsTask
Implements
IRuleTarget
Namespace: Amazon.CDK.AWS.Events.Targets
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class EcsTask : DeputyBase, IRuleTarget
Syntax (vb)
Public Class EcsTask Inherits DeputyBase Implements IRuleTarget
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.ECS;

            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,
                TaskCount = 1,

                // Overrides the cpu and memory values in the task definition
                Cpu = "512",
                Memory = "512"
            }));

Synopsis

Constructors

EcsTask(IEcsTaskProps)

Start a task on an ECS cluster.

Properties

SecurityGroups

The security groups associated with the task.

Methods

Bind(IRule, string?)

Allows using tasks as target of EventBridge events.

Constructors

EcsTask(IEcsTaskProps)

Start a task on an ECS cluster.

public EcsTask(IEcsTaskProps props)
Parameters
props IEcsTaskProps
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.ECS;

            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,
                TaskCount = 1,

                // Overrides the cpu and memory values in the task definition
                Cpu = "512",
                Memory = "512"
            }));

Properties

SecurityGroups

The security groups associated with the task.

public virtual ISecurityGroup[]? SecurityGroups { get; }
Property Value

ISecurityGroup[]

Remarks

Only applicable with awsvpc network mode.

Default: - A new security group is created.

Methods

Bind(IRule, string?)

Allows using tasks as target of EventBridge events.

public virtual IRuleTargetConfig Bind(IRule rule, string? id = null)
Parameters
rule IRule
id string
Returns

IRuleTargetConfig

Remarks

ExampleMetadata: infused

Implements

IRuleTarget
Back to top Generated by DocFX