How to rename IAM username on AWS

The
You can download this article in PDF format to support us through the following link.

Download the guide in PDF format

turn off
The

The
The

How do I update or rename IAM users on AWS? AWS IAM services (identity and access management) enable you to securely manage access to AWS services and resources. IAM allows cloud administrators to create and manage AWS users and groups with relevant permissions to access AWS resources.

After the user is created, changing the account is not common. In most cases, the modification of the access keys and ssh keys for automated operations is key operation. This guide will demonstrate how to modify an IAM user account to update / change its name.

When changing the user name or path, the following will happen:

  • Any policies attached to the user are kept in the user’s hands under the new name.
  • The user stays in the same group with the new name.
  • The user’s unique ID remains unchanged.
  • Any resource or role policy that refers to the user as a principal (granting access to the user) is automatically updated to use the new name or path.

Step 1: Configure the AWS CLI

Please note that there is no option to rename users in the AWS console. To change the username or path, you must use the AWS CLI, Windows PowerShell tool, or AWS API.

To do this, you will need the latest major version of the AWS CLI.

Install and use the AWS CLI on Linux

After the configuration is complete, confirm its normal operation:

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

Step 2: Create an IAM user

Let’s create a demo user, we will change its name later. I will create a file called Fedos

aws iam create-user --user-name fedosh

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 users on AWS

We will use the command syntax:

aws iam update-user --user-name  --new-user-name 

I changed the created username 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 content can be confirmed from the web console:

prior to:

Rear:

How to rename IAM username on AWS

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

aws iam delete-user --user-name computingforgeeks

More information about AWS:

Create RHEL / CentOS 8 custom AMI for AWS using Image Builder

The highest rated AWS Cloud certification preparation

How to reset / change IAM user password on AWS

How to reset RDS master user password on AWS

The
You can download this article in PDF format to support us through the following link.

Download the guide in PDF format

turn off
The

The
The

Sidebar