aws-cdk-lib.aws_events_targets.EcsTask
class EcsTask
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Events.Targets.EcsTask |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awseventstargets#EcsTask |
![]() | software.amazon.awscdk.services.events.targets.EcsTask |
![]() | aws_cdk.aws_events_targets.EcsTask |
![]() | aws-cdk-lib » aws_events_targets » EcsTask |
Implements
IRule
Start a task on an ECS cluster.
Example
import * as ecs from "aws-cdk-lib/aws-ecs"
declare const cluster: ecs.ICluster
declare const taskDefinition: ecs.TaskDefinition
const rule = new events.Rule(this, 'Rule', {
schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});
rule.addTarget(new targets.EcsTask({
cluster,
taskDefinition,
taskCount: 1,
containerOverrides: [{
containerName: 'TheContainer',
command: ['echo', events.EventField.fromPath('$.detail.event')],
}],
enableExecuteCommand: true,
}));
Initializer
new EcsTask(props: EcsTaskProps)
Parameters
- props
Ecs
Task Props
Properties
Name | Type | Description |
---|---|---|
security | ISecurity [] | The security groups associated with the task. |
securityGroups?
Type:
ISecurity
[]
(optional, default: A new security group is created.)
The security groups associated with the task.
Only applicable with awsvpc network mode.
Methods
Name | Description |
---|---|
bind(_rule, _id?) | Allows using tasks as target of EventBridge events. |
bind(_rule, _id?)
public bind(_rule: IRule, _id?: string): RuleTargetConfig
Parameters
- _rule
IRule
- _id
string
Returns
Allows using tasks as target of EventBridge events.