Search code examples
amazon-web-servicesamazon-ec2amazon-ami

How to add custom user name for EC2 AMI for connect to instance page in AWS UI?


I created an AMI using AWS Linux 2, which uses ec2-user as the default user for ssh.

When I directly spin up an EC2 machine. It shows

ssh -i "abcd.pem" ec2-user@ec2-22.22.22.22.us-west-2.compute.amazonaws.com

but when I create an AMI. Then It shows

ssh -i "abcd.pem" root@ec2-22.22.22.22.us-west-2.compute.amazonaws.com

same shown in the imge below 👇

Image showing AWS UI Connect to instance | SSH Client

I want somehow to make it ec2-user instead of root in the UI.

Is there any way through which I can configure what should be the username shown in the AWS UI?


Solution

  • The username shown on the SSH client tab is just a non modifiable placeholder. Users and permissions on EC2 are managed at OS-level, where the standard AMIs have a different default user, as stated on the official docs.

    There's no way to change that page.