AutoScaling / Client / cancel_instance_refresh

cancel_instance_refresh

AutoScaling.Client.cancel_instance_refresh(**kwargs)

Cancels an instance refresh or rollback that is in progress. If an instance refresh or rollback is not in progress, an ActiveInstanceRefreshNotFound error occurs.

This operation is part of the instance refresh feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group after you make configuration changes.

When you cancel an instance refresh, this does not roll back any changes that it made. Use the RollbackInstanceRefresh API to roll back instead.

See also: AWS API Documentation

Request Syntax

response = client.cancel_instance_refresh(
    AutoScalingGroupName='string',
    WaitForTransitioningInstances=True|False
)
Parameters:
  • AutoScalingGroupName (string) –

    [REQUIRED]

    The name of the Auto Scaling group.

  • WaitForTransitioningInstances (boolean) –

    When cancelling an instance refresh, this indicates whether to wait for in-flight launches and terminations to complete. The default is true.

    When set to false, Amazon EC2 Auto Scaling cancels the instance refresh without waiting for any pending launches or terminations to complete.

Return type:

dict

Returns:

Response Syntax

{
    'InstanceRefreshId': 'string'
}

Response Structure

  • (dict) –

    • InstanceRefreshId (string) –

      The instance refresh ID associated with the request. This is the unique ID assigned to the instance refresh when it was started.

Exceptions

  • AutoScaling.Client.exceptions.LimitExceededFault

  • AutoScaling.Client.exceptions.ResourceContentionFault

  • AutoScaling.Client.exceptions.ActiveInstanceRefreshNotFoundFault

Examples

This example cancels an instance refresh operation in progress.

response = client.cancel_instance_refresh(
    AutoScalingGroupName='my-auto-scaling-group',
)

print(response)

Expected Output:

{
    'InstanceRefreshId': '08b91cf7-8fa6-48af-b6a6-d227f40f1b9b',
    'ResponseMetadata': {
        '...': '...',
    },
}