:doc:`CloudFormation <../../cloudformation>` / Client / rollback_stack

**************
rollback_stack
**************



.. py:method:: CloudFormation.Client.rollback_stack(**kwargs)

  

  When specifying ``RollbackStack``, you preserve the state of previously provisioned resources when an operation fails. You can check the status of the stack through the  DescribeStacks operation.

   

  Rolls back the specified stack to the last known stable state from ``CREATE_FAILED`` or ``UPDATE_FAILED`` stack statuses.

   

  This operation will delete a stack if it doesn't contain a last known stable state. A last known stable state includes any status in a ``*_COMPLETE``. This includes the following stack statuses.

   

  
  * ``CREATE_COMPLETE``
   
  * ``UPDATE_COMPLETE``
   
  * ``UPDATE_ROLLBACK_COMPLETE``
   
  * ``IMPORT_COMPLETE``
   
  * ``IMPORT_ROLLBACK_COMPLETE``
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/RollbackStack>`_  


  **Request Syntax**
  ::

    response = client.rollback_stack(
        StackName='string',
        RoleARN='string',
        ClientRequestToken='string',
        RetainExceptOnCreate=True|False
    )
    
  :type StackName: string
  :param StackName: **[REQUIRED]** 

    The name that's associated with the stack.

    

  
  :type RoleARN: string
  :param RoleARN: 

    The Amazon Resource Name (ARN) of an IAM role that CloudFormation assumes to rollback the stack.

    

  
  :type ClientRequestToken: string
  :param ClientRequestToken: 

    A unique identifier for this ``RollbackStack`` request.

    

  
  :type RetainExceptOnCreate: boolean
  :param RetainExceptOnCreate: 

    When set to ``true``, newly created resources are deleted when the operation rolls back. This includes newly created resources marked with a deletion policy of ``Retain``.

     

    Default: ``false``

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'StackId': 'string',
          'OperationId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **StackId** *(string) --* 

        Unique identifier of the stack.

        
      

      - **OperationId** *(string) --* 

        A unique identifier for this rollback operation that can be used to track the operation's progress and events.

        
  
  **Exceptions**
  
  *   :py:class:`CloudFormation.Client.exceptions.TokenAlreadyExistsException`

  