How to identify groups that an IAM user belongs to

Run the below command to list all the groups that an IAM user belongs to where username is the name of the user.

aws iam list-groups-for-user --user-name username

See also  How to create an IAM Group