ScheduledTaskBaseProps

class aws_cdk.aws_ecs_patterns.ScheduledTaskBaseProps(*, schedule, cluster=None, desired_task_count=None, enabled=None, propagate_tags=None, rule_name=None, security_groups=None, subnet_selection=None, tags=None, vpc=None)

Bases: object

The properties for the base ScheduledEc2Task or ScheduledFargateTask task.

Parameters:
  • 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

  • enabled (Optional[bool]) – Indicates whether the rule is enabled. Default: true

  • propagate_tags (Optional[PropagatedTagSource]) – Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Default: - Tags will not be propagated

  • rule_name (Optional[str]) – A name for the rule. Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the rule name. For more information, see Name Type.

  • security_groups (Optional[Sequence[ISecurityGroup]]) – Existing security groups to use for your service. Default: - a new security group will be created.

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

  • tags (Optional[Sequence[Union[Tag, Dict[str, Any]]]]) – 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. Default: - No tags are applied to the task

  • 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.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_applicationautoscaling as appscaling
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_ecs as ecs
from aws_cdk import aws_ecs_patterns as ecs_patterns

# cluster: ecs.Cluster
# schedule: appscaling.Schedule
# security_group: ec2.SecurityGroup
# subnet: ec2.Subnet
# subnet_filter: ec2.SubnetFilter
# vpc: ec2.Vpc

scheduled_task_base_props = ecs_patterns.ScheduledTaskBaseProps(
    schedule=schedule,

    # the properties below are optional
    cluster=cluster,
    desired_task_count=123,
    enabled=False,
    propagate_tags=ecs.PropagatedTagSource.SERVICE,
    rule_name="ruleName",
    security_groups=[security_group],
    subnet_selection=ec2.SubnetSelection(
        availability_zones=["availabilityZones"],
        one_per_az=False,
        subnet_filters=[subnet_filter],
        subnet_group_name="subnetGroupName",
        subnets=[subnet],
        subnet_type=ec2.SubnetType.PRIVATE_ISOLATED
    ),
    tags=[Tag(
        key="key",
        value="value"
    )],
    vpc=vpc
)

Attributes

cluster

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

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

Default:

1

enabled

Indicates whether the rule is enabled.

Default:

true

propagate_tags

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

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

Default:
  • Tags will not be propagated

rule_name

A name for the rule.

Default:

  • AWS CloudFormation generates a unique physical ID and uses that ID

for the rule name. For more information, see Name Type.

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.

security_groups

Existing security groups to use for your service.

Default:
  • a new security group will be created.

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

tags

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.

Default:
  • No tags are applied to the task

vpc

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.