aws-cdk-lib.aws_ecs_patterns.ScheduledTaskBase

class ScheduledTaskBase

LanguageType name
.NETAmazon.CDK.AWS.ECS.Patterns.ScheduledTaskBase
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsecspatterns#ScheduledTaskBase
Javasoftware.amazon.awscdk.services.ecs.patterns.ScheduledTaskBase
Pythonaws_cdk.aws_ecs_patterns.ScheduledTaskBase
TypeScript (source)aws-cdk-lib » aws_ecs_patterns » ScheduledTaskBase

Implements IConstruct, IDependable

Extends Construct

Implemented by ScheduledEc2Task, ScheduledFargateTask

The base class for ScheduledEc2Task and ScheduledFargateTask tasks.

Initializer

new ScheduledTaskBase(scope: Construct, id: string, props: ScheduledTaskBaseProps)

Parameters

  • scope Construct
  • id string
  • props ScheduledTaskBaseProps

Constructs a new instance of the ScheduledTaskBase class.

Properties

NameTypeDescription
clusterIClusterThe name of the cluster that hosts the service.
desiredTaskCountnumberThe desired number of instantiations of the task definition to keep running on the service.
eventRuleRuleThe CloudWatch Events rule for the service.
nodeNodeThe tree node.
subnetSelectionSubnetSelectionIn what subnets to place the task's ENIs.
propagateTags?PropagatedTagSourceSpecifies whether to propagate the tags from the task definition to the task.
tags?Tag[]The metadata that you apply to the task to help you categorize and organize them.

cluster

Type: ICluster

The name of the cluster that hosts the service.


desiredTaskCount

Type: number

The desired number of instantiations of the task definition to keep running on the service.

The minimum value is 1


eventRule

Type: Rule

The CloudWatch Events rule for the service.


node

Type: Node

The tree node.


subnetSelection

Type: SubnetSelection

In what subnets to place the task's ENIs.

(Only applicable in case the TaskDefinition is configured for AwsVpc networking)


propagateTags?

Type: PropagatedTagSource (optional, default: Tags will not be propagated)

Specifies whether to propagate the tags from the task definition to the task.

If no value is specified, the tags are not propagated.


tags?

Type: Tag[] (optional, default: No tags are applied to the task)

The metadata that you apply to the task to help you categorize and organize them.

Each tag consists of a key and an optional value, both of which you define.

Methods

NameDescription
toString()Returns a string representation of this construct.
protected addTaskAsTarget(ecsTaskTarget)Adds task as a target of the scheduled event rule.
protected addTaskDefinitionToEventTarget(taskDefinition)Create an ECS task using the task definition provided and add it to the scheduled event rule.
protected createAWSLogDriver(prefix)Create an AWS Log Driver with the provided streamPrefix.
protected getDefaultCluster(scope, vpc?)Returns the default cluster.

toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


protected addTaskAsTarget(ecsTaskTarget)

protected addTaskAsTarget(ecsTaskTarget: EcsTask): void

Parameters

  • ecsTaskTarget EcsTask — the EcsTask to add to the event rule.

Adds task as a target of the scheduled event rule.


protected addTaskDefinitionToEventTarget(taskDefinition)

protected addTaskDefinitionToEventTarget(taskDefinition: TaskDefinition): EcsTask

Parameters

  • taskDefinition TaskDefinition — the TaskDefinition to add to the event rule.

Returns

  • EcsTask

Create an ECS task using the task definition provided and add it to the scheduled event rule.


protected createAWSLogDriver(prefix)

protected createAWSLogDriver(prefix: string): AwsLogDriver

Parameters

  • prefix string — the Cloudwatch logging prefix.

Returns

  • AwsLogDriver

Create an AWS Log Driver with the provided streamPrefix.


protected getDefaultCluster(scope, vpc?)

protected getDefaultCluster(scope: Construct, vpc?: IVpc): Cluster

Parameters

  • scope Construct
  • vpc IVpc

Returns

  • Cluster

Returns the default cluster.