elijah-roberts: @kyleknap @elysahall  Anything else I can do for this PR? 
nckturner: @elijah-roberts in your example from the issue, the context name is set to the same value as the user name.  Is that missing from this PR?
nckturner: Nvm, I think I see how it works now, alias was already provided as a flag to set context name.  While using alias for both username and context name would work, it seems like we could add a `--user` flag and not worry about breaking any users relying on the current behavior.  
kdaily: Hi @elijah-roberts, can you address @nckturner's suggestions?
elijah-roberts: > Nvm, I think I see how it works now, alias was already provided as a flag to set context name. While using alias for both username and context name would work, it seems like we could add a `--user` flag and not worry about breaking any users relying on the current behavior.

That would work for me 👍  I can plan on implementing a flag and testing that out. 
codecov-io: # [Codecov](https://codecov.io/gh/aws/aws-cli/pull/5165?src=pr&el=h1) Report
> Merging [#5165](https://codecov.io/gh/aws/aws-cli/pull/5165?src=pr&el=desc) into [develop](https://codecov.io/gh/aws/aws-cli/commit/2d07d7c7eece9cb5e991fa5a9129d46e17f31d91?el=desc) will **not change** coverage.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/aws/aws-cli/pull/5165/graphs/tree.svg?width=650&height=150&src=pr&token=aKPbq1EbIm)](https://codecov.io/gh/aws/aws-cli/pull/5165?src=pr&el=tree)

```diff
@@           Coverage Diff            @@
##           develop    #5165   +/-   ##
========================================
  Coverage    93.97%   93.97%           
========================================
  Files          188      188           
  Lines        14548    14548           
========================================
  Hits         13672    13672           
  Misses         876      876           
```


| [Impacted Files](https://codecov.io/gh/aws/aws-cli/pull/5165?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [awscli/customizations/eks/update\_kubeconfig.py](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL2Vrcy91cGRhdGVfa3ViZWNvbmZpZy5weQ==) | `97.93% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/aws/aws-cli/pull/5165?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/aws/aws-cli/pull/5165?src=pr&el=footer). Last update [2d07d7c...9968a77](https://codecov.io/gh/aws/aws-cli/pull/5165?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

elijah-roberts: @nckturner @kdaily  I appreciate your reviewing my PR. I updated with the changes you suggested by breaking out this logic into a new flag `user-alias`. I have updated tests, and confirmed that it is working as expected for myself. 


elijah-roberts: @nckturner @kdaily  Looks like the codecov/project failed despite the fact that I added testes for the code that I added. Is there something else that I need to do?
kdaily: @nckturner - let me know here if this is good to go!

@elijah-roberts - I'll look into the coverage failure.

Thanks both!
elijah-roberts: Bump... @kdaily  Any update on this?
nckturner: @kdaily this LGTM
potto007: My team could really use this feature. @kdaily is this going to be merged?

Thanks!
joaoubaldo: +1 waiting for this to be merged. Any updates @kdaily?
kdaily: @joaoubaldo, @potto007, @elijah-roberts - this feature still needs review from the CLI team, and it is on the agenda for review. Marking it as such now. It's on the radar, but I don't know when it will be able to pull in.
joshdk: +1 - This feature would be a welcome addition
elijah-roberts: @joaoubaldo, @potto007, @kdaily bumping again, this is a simple non-breaking change that is useful for supporting the creation of multiple kube-configs for different roles. For enterprise EKS users typically there will be a daily role that has limited permissions, and mappings. There will also be a break-glass type admin role. Current state to support both of these you have to manually manage your kubeconfig file, or constantly overwrite the associated user each time you update the config with a different role. 

Any chance we can get a review on this ? I am happy to make any necessary changes.
codecov-commenter: # [Codecov](https://codecov.io/gh/aws/aws-cli/pull/5165?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws) Report
> Merging [#5165](https://codecov.io/gh/aws/aws-cli/pull/5165?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws) (9968a77) into [develop](https://codecov.io/gh/aws/aws-cli/commit/aa82eabdd677bbd02375452aaa577b8fd89f2c87?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws) (aa82eab) will **increase** coverage by `92.43%`.
> The diff coverage is `100.00%`.

> :exclamation: Current head 9968a77 differs from pull request most recent head 41990a9. Consider uploading reports for the commit 41990a9 to get more accurate results

```diff
@@             Coverage Diff              @@
##           develop    #5165       +/-   ##
============================================
+ Coverage     0.08%   92.52%   +92.43%     
============================================
  Files          206      196       -10     
  Lines        16475    15898      -577     
============================================
+ Hits            14    14709    +14695     
+ Misses       16461     1189    -15272     
```


| [Impacted Files](https://codecov.io/gh/aws/aws-cli/pull/5165?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws) | Coverage Δ | |
|---|---|---|
| [awscli/customizations/eks/update\_kubeconfig.py](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL2Vrcy91cGRhdGVfa3ViZWNvbmZpZy5weQ==) | `97.93% <100.00%> (+97.93%)` | :arrow_up: |
| [awscli/customizations/overridesslcommonname.py](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL292ZXJyaWRlc3NsY29tbW9ubmFtZS5weQ==) | | |
| [awscli/customizations/emrcontainers/iam.py](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL2VtcmNvbnRhaW5lcnMvaWFtLnB5) | | |
| [awscli/customizations/emrcontainers/constants.py](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL2VtcmNvbnRhaW5lcnMvY29uc3RhbnRzLnB5) | | |
| [awscli/customizations/ecs/executecommand.py](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL2Vjcy9leGVjdXRlY29tbWFuZC5weQ==) | | |
| [...izations/emrcontainers/update\_role\_trust\_policy.py](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL2VtcmNvbnRhaW5lcnMvdXBkYXRlX3JvbGVfdHJ1c3RfcG9saWN5LnB5) | | |
| [awscli/customizations/kinesis.py](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL2tpbmVzaXMucHk=) | | |
| [awscli/customizations/emrcontainers/\_\_init\_\_.py](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL2VtcmNvbnRhaW5lcnMvX19pbml0X18ucHk=) | | |
| [awscli/customizations/ecr\_public.py](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL2Vjcl9wdWJsaWMucHk=) | | |
| [awscli/customizations/emrcontainers/eks.py](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL2VtcmNvbnRhaW5lcnMvZWtzLnB5) | | |
| ... and [195 more](https://codecov.io/gh/aws/aws-cli/pull/5165/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws) | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws)

elijah-roberts: Pulled in latest changes from develop, and the code coverage report looks good now
yuxiang-zhang: We are trying to prioritize this feature request and get it merged soon. Note that this implements the same feature as #5413 
joshuamkite: > We are trying to prioritize this feature request and get it merged soon. Note that this implements the same feature as #5413

Thanks but that issue has also been open for the best part of 3 years. What's the holdup?
diff --git a/.changes/next-release/enhancement-eks-48703.json b/.changes/next-release/enhancement-eks-48703.json
new file mode 100644
index 000000000..0e8789223
--- /dev/null
+++ b/.changes/next-release/enhancement-eks-48703.json
@@ -0,0 +1,5 @@
+{
+  "type": "enhancement",
+  "category": "eks",
+  "description": "Add user-alias argument to update-kubeconfig command. Implements `#5164 <https://github.com/aws/aws-cli/issues/5164>`__"
+}
diff --git a/awscli/customizations/eks/update_kubeconfig.py b/awscli/customizations/eks/update_kubeconfig.py
index 3bd0b48d1..25eccd2cb 100644
--- a/awscli/customizations/eks/update_kubeconfig.py
+++ b/awscli/customizations/eks/update_kubeconfig.py
@@ -96,6 +96,12 @@ class UpdateKubeconfigCommand(BasicCommand):
             'help_text': ("Alias for the cluster context name. "
                           "Defaults to match cluster ARN."),
             'required': False
+        },
+        {
+            'name': 'user-alias',
+            'help_text': ("Alias for the generated user name. "
+                          "Defaults to match cluster ARN."),
+            'required': False
         }
     ]
 
@@ -117,7 +123,7 @@ class UpdateKubeconfigCommand(BasicCommand):
                            parsed_args.role_arn,
                            parsed_globals)
         new_cluster_dict = client.get_cluster_entry()
-        new_user_dict = client.get_user_entry()
+        new_user_dict = client.get_user_entry(user_alias=parsed_args.user_alias)
 
         config_selector = KubeconfigSelector(
             os.environ.get("KUBECONFIG", ""),
@@ -283,7 +289,7 @@ class EKSClient(object):
             ("name", arn)
         ])
 
-    def get_user_entry(self):
+    def get_user_entry(self, user_alias=None):
         """
         Return a user entry generated using
         the previously obtained description.
@@ -301,7 +307,7 @@ class EKSClient(object):
             cluster_identification_value = cluster_description.get("id")
 
         generated_user = OrderedDict([
-            ("name", self._get_cluster_description().get("arn", "")),
+            ("name", user_alias or self._get_cluster_description().get("arn", "")),
             ("user", OrderedDict([
                 ("exec", OrderedDict([
                     ("apiVersion", API_VERSION),

EKS update-config should support naming the user with the passed in alias 
**Is your feature request related to a problem? Please describe.**
I have multiple aws role to k8s role mappings per cluster. The eks update-config command supports setting the `AWS_PROFILE` variable under the user config if you pass in `--profile`. However, it defaults the username to the cluster arn, so if I do this with multiple roles it gets overwritten  

**Describe the solution you'd like**
There is already precedent for overriding the context name by passing an `--alias`. If I run the following:
`aws eks update-kubeconfig --name <clustername> --alias prod-admin --profile prod-admin-role` 

AND

`aws eks update-kubeconfig --name <clustername> --alias prod-support --profile prod-support-role` 

I would like for the following config to be created:

```
- context:
    cluster: arn:aws:eks:us-west-2:redacted:cluster/prod-cluster
    user: prod-admin
  name: prod-admin
- context:
    cluster: arn:aws:eks:us-west-2:redacted:cluster/prod-cluster
    user: prod-support
  name: prod-support
kind: Config
preferences: {}
users:
- name: prod-admin
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - --region
      - us-west-2
      - eks
      - get-token
      - --cluster-name
      - prod-cluster
      command: aws
      env:
      - name: AWS_PROFILE
        value: prod-admin-role
- name: prod-support
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - --region
      - us-west-2
      - eks
      - get-token
      - --cluster-name
      - prod-cluster
      command: aws
      env:
      - name: AWS_PROFILE
        value: prod-support-role
```

This will allow me to simply run a command to loop through all my roles, list eks-clusters, and define contexts for each cluster and role.


**Describe alternatives you've considered**
I could create a separate utility to do this, but honestly even forking this repo and making the small change would be easier. 


**Additional context**

I have this working locally, and it is a 2 line change to match existing functionality with context naming.  


diff --git a/tests/unit/customizations/eks/test_update_kubeconfig.py b/tests/unit/customizations/eks/test_update_kubeconfig.py
index 9fc07ea9b..f7972e8cc 100644
--- a/tests/unit/customizations/eks/test_update_kubeconfig.py
+++ b/tests/unit/customizations/eks/test_update_kubeconfig.py
@@ -307,3 +307,20 @@ class TestEKSClient(unittest.TestCase):
             name="ExampleCluster"
         )
         self._session.create_client.assert_called_once_with("eks")
+
+    def test_create_user_with_alias(self):
+        self._correct_user_entry["name"] = "alias"
+        self.assertEqual(self._client.get_user_entry(user_alias="alias"),
+                         self._correct_user_entry)
+        self._mock_client.describe_cluster.assert_called_once_with(
+            name="ExampleCluster"
+        )
+        self._session.create_client.assert_called_once_with("eks")
+
+    def test_create_user_without_alias(self):
+        self.assertEqual(self._client.get_user_entry(),
+                         self._correct_user_entry)
+        self._mock_client.describe_cluster.assert_called_once_with(
+            name="ExampleCluster"
+        )
+        self._session.create_client.assert_called_once_with("eks")

pip install -e .
parse_log_pytest
requirements.txt
pytest
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
-e git+https://github.com/aws/aws-cli.git@c05713eab7d994d3806c52b4c7dc30d99db24190#egg=awscli
botocore==1.29.96
colorama==0.4.4
docutils==0.16
exceptiongroup==1.2.2
iniconfig==2.1.0
jmespath==1.0.1
packaging==24.2
pluggy==1.5.0
pyasn1==0.6.1
pytest==8.3.5
python-dateutil==2.9.0.post0
PyYAML==5.4.1
rsa==4.7.2
s3transfer==0.6.2
six==1.17.0
tomli==2.2.1
urllib3==1.26.20

name: aws-cli
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - awscli==1.27.96
      - botocore==1.29.96
      - colorama==0.4.4
      - docutils==0.16
      - exceptiongroup==1.2.2
      - iniconfig==2.1.0
      - jmespath==1.0.1
      - packaging==24.2
      - pluggy==1.5.0
      - pyasn1==0.6.1
      - pytest==8.3.5
      - python-dateutil==2.9.0.post0
      - pyyaml==5.4.1
      - rsa==4.7.2
      - s3transfer==0.6.2
      - six==1.17.0
      - tomli==2.2.1
      - urllib3==1.26.20
prefix: /opt/conda/envs/aws-cli

tests/unit/customizations/eks/test_update_kubeconfig.py::TestEKSClient::test_create_user_with_alias
tests/unit/customizations/eks/test_update_kubeconfig.py::TestKubeconfigSelector::test_arg_override tests/unit/customizations/eks/test_update_kubeconfig.py::TestKubeconfigSelector::test_arg_override_first_corrupted tests/unit/customizations/eks/test_update_kubeconfig.py::TestKubeconfigSelector::test_choose_env_only tests/unit/customizations/eks/test_update_kubeconfig.py::TestKubeconfigSelector::test_choose_existing tests/unit/customizations/eks/test_update_kubeconfig.py::TestKubeconfigSelector::test_first_corrupted tests/unit/customizations/eks/test_update_kubeconfig.py::TestKubeconfigSelector::test_parse_env_variable tests/unit/customizations/eks/test_update_kubeconfig.py::TestEKSClient::test_cluster_creating tests/unit/customizations/eks/test_update_kubeconfig.py::TestEKSClient::test_cluster_deleting tests/unit/customizations/eks/test_update_kubeconfig.py::TestEKSClient::test_create_user_without_alias tests/unit/customizations/eks/test_update_kubeconfig.py::TestEKSClient::test_get_both tests/unit/customizations/eks/test_update_kubeconfig.py::TestEKSClient::test_get_cluster_description tests/unit/customizations/eks/test_update_kubeconfig.py::TestEKSClient::test_get_cluster_description_no_status tests/unit/customizations/eks/test_update_kubeconfig.py::TestEKSClient::test_get_cluster_entry tests/unit/customizations/eks/test_update_kubeconfig.py::TestEKSClient::test_get_user_entry tests/unit/customizations/eks/test_update_kubeconfig.py::TestEKSClient::test_get_user_entry_outpost_cluster tests/unit/customizations/eks/test_update_kubeconfig.py::TestEKSClient::test_profile
.changes/next-release/enhancement-eks-48703.json awscli/customizations/eks/update_kubeconfig.py
.changes/next-release/enhancement-eks-48703.json awscli/customizations/eks/update_kubeconfig.py