You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

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:

in stock
in stock
in stock

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:



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

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF