How to check if an IAM user has a login profile(password)

Determine if a user has login profile by running the below command.

aws iam get-login-profile --user-name username

Sample output of a user that has password is as below: You will see Password created date, Password Reset Required, and username in the output.

LOGINPROFILE 2018-03-18T17:06:44Z False username

Below is the sample output of a user that does not have a password:

A client error (NoSuchEntity) occurred when calling the GetLoginProfile operation: Login Profile for User username cannot be found.
See also  How to get current timestamp in Redshift database