:doc:`IAM <../../iam>` / Client / get_access_key_last_used

************************
get_access_key_last_used
************************



.. py:method:: IAM.Client.get_access_key_last_used(**kwargs)

  

  Retrieves information about when the specified access key was last used. The information includes the date and time of last use, along with the Amazon Web Services service and Region that were specified in the last request made with that key.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetAccessKeyLastUsed>`_  


  **Request Syntax**
  ::

    response = client.get_access_key_last_used(
        AccessKeyId='string'
    )
    
  :type AccessKeyId: string
  :param AccessKeyId: **[REQUIRED]** 

    The identifier of an access key.

     

    This parameter allows (through its `regex pattern <http://wikipedia.org/wiki/regex>`__) a string of characters that can consist of any upper or lowercased letter or digit.

    

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

    
    ::

      {
          'UserName': 'string',
          'AccessKeyLastUsed': {
              'LastUsedDate': datetime(2015, 1, 1),
              'ServiceName': 'string',
              'Region': 'string'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 

      Contains the response to a successful `GetAccessKeyLastUsed <https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetAccessKeyLastUsed.html>`__ request. It is also returned as a member of the `AccessKeyMetaData <https://docs.aws.amazon.com/IAM/latest/APIReference/API_AccessKeyMetaData.html>`__ structure returned by the `ListAccessKeys <https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListAccessKeys.html>`__ action.

      
      

      - **UserName** *(string) --* 

        The name of the IAM user that owns this access key.

        
      

      - **AccessKeyLastUsed** *(dict) --* 

        Contains information about the last time the access key was used.

        
        

        - **LastUsedDate** *(datetime) --* 

          The date and time, in `ISO 8601 date-time format <http://www.iso.org/iso/iso8601>`__, when the access key was most recently used. This field is null in the following situations:

           

          
          * The user does not have an access key.
           
          * An access key exists but has not been used since IAM began tracking this information.
           
          * There is no sign-in data associated with the user.
          

          
        

        - **ServiceName** *(string) --* 

          The name of the Amazon Web Services service with which this access key was most recently used. The value of this field is "N/A" in the following situations:

           

          
          * The user does not have an access key.
           
          * An access key exists but has not been used since IAM started tracking this information.
           
          * There is no sign-in data associated with the user.
          

          
        

        - **Region** *(string) --* 

          The Amazon Web Services Region where this access key was most recently used. The value for this field is "N/A" in the following situations:

           

          
          * The user does not have an access key.
           
          * An access key exists but has not been used since IAM began tracking this information.
           
          * There is no sign-in data associated with the user.
          

           

          For more information about Amazon Web Services Regions, see `Regions and endpoints <https://docs.aws.amazon.com/general/latest/gr/rande.html>`__ in the Amazon Web Services General Reference.

          
    
  