ScheduledEc2Task

class aws_cdk.aws_ecs_patterns.ScheduledEc2Task(scope, id, *, scheduled_ec2_task_definition_options=None, scheduled_ec2_task_image_options=None, schedule, cluster=None, desired_task_count=None, subnet_selection=None, vpc=None)

Bases: aws_cdk.aws_ecs_patterns.ScheduledTaskBase

A scheduled EC2 task that will be initiated off of CloudWatch Events.

Constructs a new instance of the ScheduledEc2Task class.

Parameters
  • scope (Construct) –

  • id (str) –

  • scheduled_ec2_task_definition_options (Optional[ScheduledEc2TaskDefinitionOptions]) – The properties to define if using an existing TaskDefinition in this construct. ScheduledEc2TaskDefinitionOptions or ScheduledEc2TaskImageOptions must be defined, but not both. Default: none

  • scheduled_ec2_task_image_options (Optional[ScheduledEc2TaskImageOptions]) – The properties to define if the construct is to create a TaskDefinition. ScheduledEc2TaskDefinitionOptions or ScheduledEc2TaskImageOptions must be defined, but not both. Default: none

  • schedule (Schedule) – The schedule or rate (frequency) that determines when CloudWatch Events runs the rule. For more information, see Schedule Expression Syntax for Rules in the Amazon CloudWatch User Guide.

  • cluster (Optional[ICluster]) – The name of the cluster that hosts the service. If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you.

  • desired_task_count (Union[int, float, None]) – The desired number of instantiations of the task definition to keep running on the service. Default: 1

  • 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

  • vpc (Optional[IVpc]) – The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. Default: - uses the VPC defined in the cluster or creates a new VPC.

Methods

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

cluster

The name of the cluster that hosts the service.

Return type

ICluster

desired_task_count

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

The minimum value is 1

Return type

Union[int, float]

event_rule

The CloudWatch Events rule for the service.

Return type

Rule

node

The construct tree node associated with this construct.

Return type

ConstructNode

subnet_selection

In what subnets to place the task’s ENIs.

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

Default

Private subnets

Return type

SubnetSelection

task_definition

The EC2 task definition in this construct.

Return type

Ec2TaskDefinition

Static Methods

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool