class EcsTask
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Events.Targets.EcsTask |
![]() | software.amazon.awscdk.services.events.targets.EcsTask |
![]() | aws_cdk.aws_events_targets.EcsTask |
![]() | @aws-cdk/aws-events-targets » EcsTask |
Implements
IRule
Start a task on an ECS cluster.
Example
import { Rule, Schedule } from '@aws-cdk/aws-events';
import { EcsTask } from '@aws-cdk/aws-events-targets';
import { Cluster, TaskDefinition } from '@aws-cdk/aws-ecs';
import { Role } from '@aws-cdk/aws-iam';
declare const cluster: Cluster;
declare const taskDefinition: TaskDefinition;
declare const role: Role;
const ecsTaskTarget = new EcsTask({ cluster, taskDefinition, role });
new Rule(this, 'ScheduleRule', {
schedule: Schedule.cron({ minute: '0', hour: '4' }),
targets: [ecsTaskTarget],
});
Initializer
new EcsTask(props: EcsTaskProps)
Parameters
- props
Ecs
Task Props
Properties
Name | Type | Description |
---|---|---|
security | ISecurity | The security group associated with the task. |
security | ISecurity [] | The security groups associated with the task. |
securityGroup?
⚠️ Deprecated: use securityGroups instead.
Type:
ISecurity
(optional, default: A new security group is created.)
The security group associated with the task.
Only applicable with awsvpc network mode.
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.