:doc:`Lightsail <../../lightsail>` / Client / get_instance_state

******************
get_instance_state
******************



.. py:method:: Lightsail.Client.get_instance_state(**kwargs)

  

  Returns the state of a specific instance. Works on one instance at a time.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceState>`_  


  **Request Syntax**
  ::

    response = client.get_instance_state(
        instanceName='string'
    )
    
  :type instanceName: string
  :param instanceName: **[REQUIRED]** 

    The name of the instance to get state information about.

    

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

    
    ::

      {
          'state': {
              'code': 123,
              'name': 'string'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **state** *(dict) --* 

        The state of the instance.

        
        

        - **code** *(integer) --* 

          The status code for the instance.

          
        

        - **name** *(string) --* 

          The state of the instance ( ``running`` or ``pending``).

          
    
  
  **Exceptions**
  
  *   :py:class:`Lightsail.Client.exceptions.ServiceException`

  
  *   :py:class:`Lightsail.Client.exceptions.InvalidInputException`

  
  *   :py:class:`Lightsail.Client.exceptions.NotFoundException`

  
  *   :py:class:`Lightsail.Client.exceptions.OperationFailureException`

  
  *   :py:class:`Lightsail.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`Lightsail.Client.exceptions.AccountSetupInProgressException`

  
  *   :py:class:`Lightsail.Client.exceptions.RegionSetupInProgressException`

  
  *   :py:class:`Lightsail.Client.exceptions.UnauthenticatedException`

  