get_access_key_last_used

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

Request Syntax

response = client.get_access_key_last_used(
    AccessKeyId='string'
)
Parameters
AccessKeyId (string) --

[REQUIRED]

The identifier of an access key.

This parameter allows (through its regex pattern ) a string of characters that can consist of any upper or lowercased letter or digit.

Return type
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 request. It is also returned as a member of the AccessKeyMetaData structure returned by the ListAccessKeys 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, 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 in the Amazon Web Services General Reference.

Exceptions

  • IAM.Client.exceptions.NoSuchEntityException