Auto Scaling

2020/06/16 - Auto Scaling - 3 new api methods

Changes  Update autoscaling client to latest version

CancelInstanceRefresh (new) Link ¶

Cancels an instance refresh operation in progress. Cancellation does not roll back any replacements that have already been completed, but it prevents new replacements from being started.

For more information, see Replacing Auto Scaling Instances Based on an Instance Refresh.

See also: AWS API Documentation

Request Syntax

client.cancel_instance_refresh(
    AutoScalingGroupName='string'
)
type AutoScalingGroupName:

string

param AutoScalingGroupName:

[REQUIRED]

The name of the Auto Scaling group.

rtype:

dict

returns:

Response Syntax

{
    'InstanceRefreshId': 'string'
}

Response Structure

  • (dict) --

    • InstanceRefreshId (string) --

      The instance refresh ID.

StartInstanceRefresh (new) Link ¶

Starts a new instance refresh operation, which triggers a rolling replacement of all previously launched instances in the Auto Scaling group with a new group of instances.

If successful, this call creates a new instance refresh request with a unique ID that you can use to track its progress. To query its status, call the DescribeInstanceRefreshes API. To describe the instance refreshes that have already run, call the DescribeInstanceRefreshes API. To cancel an active instance refresh operation, use the CancelInstanceRefresh API.

For more information, see Replacing Auto Scaling Instances Based on an Instance Refresh.

See also: AWS API Documentation

Request Syntax

client.start_instance_refresh(
    AutoScalingGroupName='string',
    Strategy='Rolling',
    Preferences={
        'MinHealthyPercentage': 123,
        'InstanceWarmup': 123
    }
)
type AutoScalingGroupName:

string

param AutoScalingGroupName:

[REQUIRED]

The name of the Auto Scaling group.

type Strategy:

string

param Strategy:

The strategy to use for the instance refresh. The only valid value is Rolling.

A rolling update is an update that is applied to all instances in an Auto Scaling group until all instances have been updated. A rolling update can fail due to failed health checks or if instances are on standby or are protected from scale-in. If the rolling update process fails, any instances that were already replaced are not rolled back to their previous configuration.

type Preferences:

dict

param Preferences:

Set of preferences associated with the instance refresh request.

  • MinHealthyPercentage (integer) --

    The amount of capacity in the Auto Scaling group that must remain healthy during an instance refresh to allow the operation to continue, as a percentage of the desired capacity of the Auto Scaling group (rounded up to the nearest integer). The default is 90.

  • InstanceWarmup (integer) --

    The number of seconds until a newly launched instance is configured and ready to use. During this time, Amazon EC2 Auto Scaling does not immediately move on to the next replacement. The default is to use the value specified for the health check grace period for the group.

    Note: While warming up, a newly launched instance is not counted toward the aggregated metrics of the Auto Scaling group.

rtype:

dict

returns:

Response Syntax

{
    'InstanceRefreshId': 'string'
}

Response Structure

  • (dict) --

    • InstanceRefreshId (string) --

      A unique ID for tracking the progress of the request.

DescribeInstanceRefreshes (new) Link ¶

Describes one or more instance refreshes.

You can determine the status of a request by looking at the Status parameter. The following are the possible statuses:

  • Pending - The request was created, but the operation has not started.

  • InProgress - The operation is in progress.

  • Successful - The operation completed successfully.

  • Failed - The operation failed to complete. You can troubleshoot using the status reason and the scaling activities.

  • Cancelling - An ongoing operation is being cancelled. Cancellation does not roll back any replacements that have already been completed, but it prevents new replacements from being started.

  • Cancelled - The operation is cancelled.

See also: AWS API Documentation

Request Syntax

client.describe_instance_refreshes(
    AutoScalingGroupName='string',
    InstanceRefreshIds=[
        'string',
    ],
    NextToken='string',
    MaxRecords=123
)
type AutoScalingGroupName:

string

param AutoScalingGroupName:

[REQUIRED]

The name of the Auto Scaling group.

type InstanceRefreshIds:

list

param InstanceRefreshIds:

One or more instance refresh IDs.

  • (string) --

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

{
    'InstanceRefreshes': [
        {
            'InstanceRefreshId': 'string',
            'AutoScalingGroupName': 'string',
            'Status': 'Pending'|'InProgress'|'Successful'|'Failed'|'Cancelling'|'Cancelled',
            'StatusReason': 'string',
            'StartTime': datetime(2015, 1, 1),
            'EndTime': datetime(2015, 1, 1),
            'PercentageComplete': 123,
            'InstancesToUpdate': 123
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • InstanceRefreshes (list) --

      The instance refreshes for the specified group.

      For more information, see Replacing Auto Scaling Instances Based on an Instance Refresh.

      • (dict) --

        Describes an instance refresh for an Auto Scaling group.

        • InstanceRefreshId (string) --

          The instance refresh ID.

        • AutoScalingGroupName (string) --

          The name of the Auto Scaling group.

        • Status (string) --

          The current status for the instance refresh operation:

          • Pending - The request was created, but the operation has not started.

          • InProgress - The operation is in progress.

          • Successful - The operation completed successfully.

          • Failed - The operation failed to complete. You can troubleshoot using the status reason and the scaling activities.

          • Cancelling - An ongoing operation is being cancelled. Cancellation does not roll back any replacements that have already been completed, but it prevents new replacements from being started.

          • Cancelled - The operation is cancelled.

        • StatusReason (string) --

          Provides more details about the current status of the instance refresh.

        • StartTime (datetime) --

          The date and time at which the instance refresh began.

        • EndTime (datetime) --

          The date and time at which the instance refresh ended.

        • PercentageComplete (integer) --

          The percentage of the instance refresh that is complete. For each instance replacement, Amazon EC2 Auto Scaling tracks the instance's health status and warm-up time. When the instance's health status changes to healthy and the specified warm-up time passes, the instance is considered updated and added to the percentage complete.

        • InstancesToUpdate (integer) --

          The number of instances remaining to update before the instance refresh is complete.

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