EcsTask

class aws_cdk.aws_events_targets.EcsTask(*, cluster, task_definition, container_overrides=None, security_group=None, security_groups=None, subnet_selection=None, task_count=None)

Bases: object

Start a task on an ECS cluster.

__init__(*, cluster, task_definition, container_overrides=None, security_group=None, security_groups=None, subnet_selection=None, task_count=None)
Parameters
  • cluster (ICluster) – Cluster where service will be deployed.

  • task_definition (TaskDefinition) – Task Definition of the task that should be started.

  • container_overrides (Optional[List[ContainerOverride]]) – Container setting overrides. Key is the name of the container to override, value is the values you want to override.

  • security_group (Optional[ISecurityGroup]) – Existing security group to use for the task’s ENIs. (Only applicable in case the TaskDefinition is configured for AwsVpc networking) Default: A new security group is created

  • security_groups (Optional[List[ISecurityGroup]]) – Existing security groups to use for the task’s ENIs. (Only applicable in case the TaskDefinition is configured for AwsVpc networking) Default: A new security group is created

  • subnet_selection (Optional[SubnetSelection]) – In what subnets to place the task’s ENIs. (Only applicable in case the TaskDefinition is configured for AwsVpc networking) Default: Private subnets

  • task_count (Union[int, float, None]) – How many tasks should be started when this event is triggered. Default: 1

Return type

None

Methods

bind(_rule, _id=None)

Allows using tasks as target of EventBridge events.

Parameters
  • _rule (IRule) –

  • _id (Optional[str]) –

Return type

RuleTargetConfig

Attributes

security_group

The security group associated with the task.

Only applicable with awsvpc network mode.

default :default: - A new security group is created.

deprecated :deprecated: use securityGroups instead.

stability :stability: deprecated

Return type

Optional[ISecurityGroup]

security_groups

The security groups associated with the task.

Only applicable with awsvpc network mode.

default :default: - A new security group is created.

Return type

Optional[List[ISecurityGroup]]