Auto Scaling

2021/03/09 - Auto Scaling - 3 updated api methods

Changes  EC2 Auto Scaling now supports setting a local time zone for cron expressions in scheduled actions, removing the need to adjust for Daylight Saving Time (DST)

BatchPutScheduledUpdateGroupAction (updated) Link ¶
Changes (request)
{'ScheduledUpdateGroupActions': {'TimeZone': 'string'}}

Creates or updates one or more scheduled scaling actions for an Auto Scaling group.

See also: AWS API Documentation

Request Syntax

client.batch_put_scheduled_update_group_action(
    AutoScalingGroupName='string',
    ScheduledUpdateGroupActions=[
        {
            'ScheduledActionName': 'string',
            'StartTime': datetime(2015, 1, 1),
            'EndTime': datetime(2015, 1, 1),
            'Recurrence': 'string',
            'MinSize': 123,
            'MaxSize': 123,
            'DesiredCapacity': 123,
            'TimeZone': 'string'
        },
    ]
)
type AutoScalingGroupName

string

param AutoScalingGroupName

[REQUIRED]

The name of the Auto Scaling group.

type ScheduledUpdateGroupActions

list

param ScheduledUpdateGroupActions

[REQUIRED]

One or more scheduled actions. The maximum number allowed is 50.

  • (dict) --

    Describes information used for one or more scheduled scaling action updates in a BatchPutScheduledUpdateGroupAction operation.

    • ScheduledActionName (string) -- [REQUIRED]

      The name of the scaling action.

    • StartTime (datetime) --

      The date and time for the action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example, "2019-06-01T00:00:00Z" ).

      If you specify Recurrence and StartTime , Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.

      If you try to schedule the action in the past, Amazon EC2 Auto Scaling returns an error message.

    • EndTime (datetime) --

      The date and time for the recurring schedule to end, in UTC.

    • Recurrence (string) --

      The recurring schedule for the action, in Unix cron syntax format. This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, "30 0 1 1,6,12 *" ). For more information about this format, see Crontab.

      When StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.

      Cron expressions use Universal Coordinated Time (UTC) by default.

    • MinSize (integer) --

      The minimum size of the Auto Scaling group.

    • MaxSize (integer) --

      The maximum size of the Auto Scaling group.

    • DesiredCapacity (integer) --

      The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.

    • TimeZone (string) --

      Specifies the time zone for a cron expression. If a time zone is not provided, UTC is used by default.

      Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as Etc/GMT+9 or Pacific/Tahiti ). For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

rtype

dict

returns

Response Syntax

{
    'FailedScheduledUpdateGroupActions': [
        {
            'ScheduledActionName': 'string',
            'ErrorCode': 'string',
            'ErrorMessage': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • FailedScheduledUpdateGroupActions (list) --

      The names of the scheduled actions that could not be created or updated, including an error message.

      • (dict) --

        Describes a scheduled action that could not be created, updated, or deleted.

        • ScheduledActionName (string) --

          The name of the scheduled action.

        • ErrorCode (string) --

          The error code.

        • ErrorMessage (string) --

          The error message accompanying the error code.

DescribeScheduledActions (updated) Link ¶
Changes (response)
{'ScheduledUpdateGroupActions': {'TimeZone': 'string'}}

Describes the actions scheduled for your Auto Scaling group that haven't run or that have not reached their end time. To describe the actions that have already run, call the DescribeScalingActivities API.

See also: AWS API Documentation

Request Syntax

client.describe_scheduled_actions(
    AutoScalingGroupName='string',
    ScheduledActionNames=[
        'string',
    ],
    StartTime=datetime(2015, 1, 1),
    EndTime=datetime(2015, 1, 1),
    NextToken='string',
    MaxRecords=123
)
type AutoScalingGroupName

string

param AutoScalingGroupName

The name of the Auto Scaling group.

type ScheduledActionNames

list

param ScheduledActionNames

The names of one or more scheduled actions. You can specify up to 50 actions. If you omit this parameter, all scheduled actions are described. If you specify an unknown scheduled action, it is ignored with no error.

  • (string) --

type StartTime

datetime

param StartTime

The earliest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.

type EndTime

datetime

param EndTime

The latest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.

type NextToken

string

param NextToken

The token for the next set of items to return. (You received this token from a previous call.)

type MaxRecords

integer

param MaxRecords

The maximum number of items to return with this call. The default value is 50 and the maximum value is 100 .

rtype

dict

returns

Response Syntax

{
    'ScheduledUpdateGroupActions': [
        {
            'AutoScalingGroupName': 'string',
            'ScheduledActionName': 'string',
            'ScheduledActionARN': 'string',
            'Time': datetime(2015, 1, 1),
            'StartTime': datetime(2015, 1, 1),
            'EndTime': datetime(2015, 1, 1),
            'Recurrence': 'string',
            'MinSize': 123,
            'MaxSize': 123,
            'DesiredCapacity': 123,
            'TimeZone': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • ScheduledUpdateGroupActions (list) --

      The scheduled actions.

      • (dict) --

        Describes a scheduled scaling action.

        • AutoScalingGroupName (string) --

          The name of the Auto Scaling group.

        • ScheduledActionName (string) --

          The name of the scheduled action.

        • ScheduledActionARN (string) --

          The Amazon Resource Name (ARN) of the scheduled action.

        • Time (datetime) --

          This parameter is no longer used.

        • StartTime (datetime) --

          The date and time in UTC for this action to start. For example, "2019-06-01T00:00:00Z" .

        • EndTime (datetime) --

          The date and time in UTC for the recurring schedule to end. For example, "2019-06-01T00:00:00Z" .

        • Recurrence (string) --

          The recurring schedule for the action, in Unix cron syntax format.

          When StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.

        • MinSize (integer) --

          The minimum size of the Auto Scaling group.

        • MaxSize (integer) --

          The maximum size of the Auto Scaling group.

        • DesiredCapacity (integer) --

          The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.

        • TimeZone (string) --

          The time zone for the cron expression.

    • NextToken (string) --

      A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.

PutScheduledUpdateGroupAction (updated) Link ¶
Changes (request)
{'TimeZone': 'string'}

Creates or updates a scheduled scaling action for an Auto Scaling group.

For more information, see Scheduled scaling in the Amazon EC2 Auto Scaling User Guide .

See also: AWS API Documentation

Request Syntax

client.put_scheduled_update_group_action(
    AutoScalingGroupName='string',
    ScheduledActionName='string',
    Time=datetime(2015, 1, 1),
    StartTime=datetime(2015, 1, 1),
    EndTime=datetime(2015, 1, 1),
    Recurrence='string',
    MinSize=123,
    MaxSize=123,
    DesiredCapacity=123,
    TimeZone='string'
)
type AutoScalingGroupName

string

param AutoScalingGroupName

[REQUIRED]

The name of the Auto Scaling group.

type ScheduledActionName

string

param ScheduledActionName

[REQUIRED]

The name of this scaling action.

type Time

datetime

param Time

This parameter is no longer used.

type StartTime

datetime

param StartTime

The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example, "2019-06-01T00:00:00Z" ).

If you specify Recurrence and StartTime , Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.

If you try to schedule your action in the past, Amazon EC2 Auto Scaling returns an error message.

type EndTime

datetime

param EndTime

The date and time for the recurring schedule to end, in UTC.

type Recurrence

string

param Recurrence

The recurring schedule for this action. This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, "30 0 1 1,6,12 *" ). For more information about this format, see Crontab.

When StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.

Cron expressions use Universal Coordinated Time (UTC) by default.

type MinSize

integer

param MinSize

The minimum size of the Auto Scaling group.

type MaxSize

integer

param MaxSize

The maximum size of the Auto Scaling group.

type DesiredCapacity

integer

param DesiredCapacity

The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. It can scale beyond this capacity if you add more scaling conditions.

type TimeZone

string

param TimeZone

Specifies the time zone for a cron expression. If a time zone is not provided, UTC is used by default.

Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as Etc/GMT+9 or Pacific/Tahiti ). For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

returns

None