How can I update or rename an IAM user on AWS?. The AWS IAM Service (Identity and Access Management) enables you to manage access to AWS services and resources securely. IAM allows a Cloud administrator to create and manage AWS users and groups with their relevant permissions for accessing AWS resources.

Once the user is created, making a change to the account is not a common task. In most cases, modifications to access keys and ssh keys for Automation operations is the key operation. This guide will demonstrate how one can modify IAM user account to update/change its name.

AWS Recommended courses:

When you change a user’s name or path, the following happens:

  • Any policies attached to the user stay with the user under the new name.
  • The user stays in the same groups under the new name.
  • The unique ID for the user remains the same.
  • Any resource or role policies that refer to the user as a principal (the user is being granted access) are automatically updated to use the new name or path.

Step 1: Configure AWS CLI

Please note that there is no option in the AWS console to rename a user. To change a user’s name or path, you must use the AWS CLI, Tools for Windows PowerShell, or AWS API.

For this operation, you’ll need the latest major version of AWS CLI.

Install and Use AWS CLI on Linux

Once configured, confirm it is working:

$ aws s3 ls
2020-04-04 22:49:47 ami-image-bucket
2019-11-20 18:27:47 mydemo-bucket

Step 2: Let’s Create an IAM User

Let’s create a Demo user that we’ll change its name later. I’ll create a user called fedosh

aws iam create-user --user-name fedosh

This the command execution output:

    "User": {
        "Path": "/",
        "UserName": "fedosh",
        "UserId": "AIDARX4Y6JA3CZXGXGR5J",
        "Arn": "arn:aws:iam::120942969046:user/fedosh",
        "CreateDate": "2020-05-26T16:14:51Z"
    }
}

Step 2: Rename IAM User on AWS

We’ll use the command syntax:

aws iam update-user --user-name <Oldname> --new-user-name <Newname>

I’ll change the name of the user I created from fedosh to computingforgeeks:

aws iam update-user --user-name fedosh --new-user-name computingforgeeks

Confirm the change:

$ aws iam list-users  | grep computingforgeeks -A 2 -B 2
        {
            "Path": "/",
            "UserName": "computingforgeeks",
            "UserId": "AIDARX4Y6JA3CZXGXGR5J",
            "Arn": "arn:aws:iam::120042965046:user/computingforgeeks",
            "CreateDate": "2020-05-26T16:14:51Z"
        }

The same can be confirmed from the web console:

Before:

rename aws iam user 01

After:

rename aws iam user 02

I can now delete the test user using the new name:

aws iam delete-user --user-name computingforgeeks

More on AWS:

Create RHEL / CentOS 8 Custom AMI for AWS Using Image Builder

Best Rated AWS Cloud Certifications Preparation Books

How to reset / change IAM user password on AWS

How to Reset RDS Master User Password on AWS

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here