Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the username of the instance launched in amazon-ec2?

Tags:

ssh

amazon-ec2

I m having trouble connecting to amazon ec2 instance using ssh. The key pair matches. On google-ing a bit i find that username is not the same for all instances. I assumed its always ec2-user. How can I find the username of the instance that I have launched?

I am getting this error:

Permission denied (publickey).

on trying this:

ssh -i test-instance.pem  [email protected]

Any help will be appreciated.

like image 503
Kevin Avatar asked Dec 26 '13 05:12

Kevin


People also ask

How do I find my EC2 instance details?

You can use EC2 Instance Metadata Query Tool which is a simple bash script that uses curl to query the EC2 instance Metadata from within a running EC2 instance as mentioned in documentation. now run command to get required data.

How do I find my instance ID?

On the Home page, select DB Instances. The Instances page opens. Filter for the DB instance that you want the ID for. The instance details page opens and displays the ID.


2 Answers

Description-

Each Linux instance launches with a default Linux system user account. The default user name is determined by the AMI that was specified when you launched the instance. For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user. For CentOS, the user name is centos. For Debian, the user name is admin or root. For Fedora, the user name is ec2-user or fedora. For RHEL, the user name is ec2-user or root. For SUSE, the user name is ec2-user or root. For Ubuntu, the user name is ubuntu. Otherwise, if ec2-user and root don't work, check with your AMI provider.

like image 63
Ankit Kumar Rajpoot Avatar answered Oct 22 '22 04:10

Ankit Kumar Rajpoot


Amazon AWS has listed default usernames here:

Default usernames for AWS AMIs

like image 21
samBuchl Avatar answered Oct 22 '22 03:10

samBuchl