How to rename IAM user

Unfortunately you cannot rename a IAM user in the AWS Management Console, but the happy news is you can rename a user from AWS CLI (Command Line Interface). Below are the steps:

1. Connect to AWS CLI (Command Line Interface) from your computer.

2. If required, use the below command to list all of your IAM users

aws iam list-users 

3. Use the below command to rename the user

aws Iam update-user --user-name existing_username --new-user-name new_user_name

aws Iam update-user --user-name ram --new-user-name ramkumar

AWS will keep all the properties of the user under the new name, for example:
  • policies associated with the user
  • user groups 
  • unique id of the user 
  • permissions of the user, s3 access permissions

Note: if there are existing policies that refer the old user name as a resource, then you will have to manually modify the policy script to change the old user name to the new name.


Popular Posts