:doc:`AutoScaling <../../autoscaling>` / Client / cancel_instance_refresh

***********************
cancel_instance_refresh
***********************



.. py:method:: 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 <https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-refresh.html>`__ 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 <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_RollbackInstanceRefresh.html>`__ API to roll back instead.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CancelInstanceRefresh>`_  


  **Request Syntax**
  ::

    response = client.cancel_instance_refresh(
        AutoScalingGroupName='string',
        WaitForTransitioningInstances=True|False
    )
    
  :type AutoScalingGroupName: string
  :param AutoScalingGroupName: **[REQUIRED]** 

    The name of the Auto Scaling group.

    

  
  :type WaitForTransitioningInstances: boolean
  :param WaitForTransitioningInstances: 

    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.

    

  
  
  :rtype: 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**
  
  *   :py:class:`AutoScaling.Client.exceptions.LimitExceededFault`

  
  *   :py:class:`AutoScaling.Client.exceptions.ResourceContentionFault`

  
  *   :py:class:`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': {
            '...': '...',
        },
    }

  