get_login_profile

get_login_profile(**kwargs)

Retrieves the user name for the specified IAM user. A login profile is created when you create a password for the user to access the Amazon Web Services Management Console. If the user does not exist or does not have a password, the operation returns a 404 ( NoSuchEntity ) error.

If you create an IAM user with access to the console, the CreateDate reflects the date you created the initial password for the user.

If you create an IAM user with programmatic access, and then later add a password for the user to access the Amazon Web Services Management Console, the CreateDate reflects the initial password creation date. A user with programmatic access does not have a login profile unless you create a password for the user to access the Amazon Web Services Management Console.

See also: AWS API Documentation

Request Syntax

response = client.get_login_profile(
    UserName='string'
)
Parameters
UserName (string) --

[REQUIRED]

The name of the user whose login profile you want to retrieve.

This parameter allows (through its regex pattern ) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Return type
dict
Returns
Response Syntax
{
    'LoginProfile': {
        'UserName': 'string',
        'CreateDate': datetime(2015, 1, 1),
        'PasswordResetRequired': True|False
    }
}

Response Structure

  • (dict) --

    Contains the response to a successful GetLoginProfile request.

    • LoginProfile (dict) --

      A structure containing the user name and the profile creation date for the user.

      • UserName (string) --

        The name of the user, which can be used for signing in to the Amazon Web Services Management Console.

      • CreateDate (datetime) --

        The date when the password for the user was created.

      • PasswordResetRequired (boolean) --

        Specifies whether the user is required to set a new password on next sign-in.

Exceptions

  • IAM.Client.exceptions.NoSuchEntityException
  • IAM.Client.exceptions.ServiceFailureException

Examples

The following command gets information about the password for the IAM user named Anika.

response = client.get_login_profile(
    UserName='Anika',
)

print(response)

Expected Output:

{
    'LoginProfile': {
        'CreateDate': datetime(2012, 9, 21, 23, 3, 39, 4, 265, 0),
        'UserName': 'Anika',
    },
    'ResponseMetadata': {
        '...': '...',
    },
}