ALIYUN::ESS::ScheduledTask

更新时间:
复制 MD 格式

ALIYUN::ESS::ScheduledTask creates a scheduled task based on specified properties.

Syntax

{
  "Type": "ALIYUN::ESS::ScheduledTask",
  "Properties": {
    "TaskEnabled": Boolean,
    "Description": String,
    "ScheduledTaskName": String,
    "LaunchExpirationTime": Integer,
    "LaunchTime": String,
    "RecurrenceEndTime": String,
    "RecurrenceType": String,
    "RecurrenceValue": String,
    "ScheduledAction": String,
    "MaxValue": Integer,
    "MinValue": Integer,
    "DesiredCapacity": Integer,
    "ScalingGroupId": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

TaskEnabled

Boolean

No

Yes

Whether to enable the scheduled task.

Valid values:

  • true (default)

  • false

Description

String

No

Yes

Description of the scheduled task.

2 to 200 characters.

ScheduledTaskName

String

No

Yes

Display name of the scheduled task.

2 to 40 characters. Can contain letters, digits, underscores (_), hyphens (-), and periods (.). Must start with a letter or digit.

Must be unique within an account in a region.

Default: the ScheduledScalingTaskId value.

LaunchExpirationTime

Integer

No

Yes

Retry window if the task fails to trigger.

Valid values: 0 to 21600.

Unit: seconds.

Default value: 600.

LaunchTime

String

Yes

Yes

Time when the task triggers.

ISO 8601 format: YYYY-MM-DDThh:mmZ.

Must be in UTC.

  • If RecurrenceType is specified, the task runs repeatedly at this time.

  • If RecurrenceType is not specified, the task runs once at this time.

Must be within 90 days of task creation or modification.

RecurrenceEndTime

String

No

Yes

End time for recurring execution.

ISO 8601 format: YYYY-MM-DDThh:mmZ.

Must be in UTC.

Must be within 90 days of task creation or modification.

RecurrenceType, RecurrenceValue, and RecurrenceEndTime must be specified together.

RecurrenceType

String

No

Yes

Recurrence interval type.

Valid values:

  • Daily: runs every specified number of days.

  • Weekly: runs on specified days of each week.

  • Monthly: runs on specified days of each month.

  • Cron: runs based on a cron expression.

RecurrenceType, RecurrenceValue, and RecurrenceEndTime must be specified together.

RecurrenceValue

String

No

Yes

Recurrence value for the scheduled task.

Valid values:

  • Daily: 1 to 31.

  • Weekly: one or more values from 0 to 6 (0 = Sunday, 6 = Saturday). Separate multiple values with commas (,).

  • Monthly: two values in A-B format. A and B range from 1 to 31. B must be greater than or equal to A.

  • Cron: a cron expression in UTC. Fields: minute, hour, day of month, month, and day of week. Supports L, W, and the special characters: , ? - * # /

RecurrenceType, RecurrenceValue, and RecurrenceEndTime must be specified together.

ScheduledAction

String

No

Yes

Operation to run when the task triggers.

Up to 200 characters.

Set to the unique identifier of a scaling rule.

MaxValue

Integer

No

Yes

Maximum number of instances in the scaling group. Applies when ScalingGroupId is specified.

None.

MinValue

Integer

No

Yes

Minimum number of instances in the scaling group. Applies when ScalingGroupId is specified.

None.

DesiredCapacity

Integer

No

Yes

Expected number of instances in the scaling group. Applies when ScalingGroupId is specified.

DesiredCapacity is required when creating a scaling group.

ScalingGroupId

String

No

Yes

ID of the scaling group to scale when the task triggers.

When ScalingGroupId is specified, you must also specify at least one of MinValue, MaxValue, or DesiredCapacity.

Note

You cannot specify both ScheduledAction and ScalingGroupId.

Return values

Fn::GetAtt

ScheduledTaskId: globally unique ID of the scheduled task, generated by the system.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Resources:
      ScheduledTask:
        Type: ALIYUN::ESS::ScheduledTask
        Properties:
          TaskEnabled: 'true'
          Description: scheduledtask
          ScheduledTaskName: task1
          LaunchTime: 2014-08-17T16:52Z
          RecurrenceEndTime: 2014-08-17T16:55Z
          RecurrenceType: Daily
          RecurrenceValue: '1'
          ScheduledAction: ari:acs:ess:cn-qingdao:1344371:scalingRule/cCBpdYdQuBe2cUxOdu6piOk
    Outputs:
      ScheduledTaskId:
        Value:
          FN::GetAtt:
            - ScheduledTask
            - ScheduledTaskId
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Resources": {
        "ScheduledTask": {
          "Type": "ALIYUN::ESS::ScheduledTask",
          "Properties": {
            "TaskEnabled": "true",
            "Description": "scheduledtask",
            "ScheduledTaskName": "task1",
            "LaunchTime": "2014-08-17T16:52Z",
            "RecurrenceEndTime": "2014-08-17T16:55Z",
            "RecurrenceType": "Daily",
            "RecurrenceValue": "1",
            "ScheduledAction": "ari:acs:ess:cn-qingdao:1344371:scalingRule/cCBpdYdQuBe2cUxOdu6piOk"
          }
        }
      },
      "Outputs": {
        "ScheduledTaskId": {
          "Value": {
            "FN::GetAtt": [
              "ScheduledTask",
              "ScheduledTaskId"
            ]
          }
        }
      }
    }