Login to AWS EC2 instances

Recently I’ve started to use AWS (Amazon Web Services) to host few of my web apps. I’ve had a little hard time to figure out how to access instances using *.pem file associated while i was creating AWS Instance.

First of all, locate pem file and assign appropriate permissions to it.


chmod 400 /path/my-key-pair.pem

Then depending upon OS (Operating System) of your ec2 instance you’ve created, you’ve to access appropriate user in order get into your ec2 instance.

Amazon Linuxec2-user
RHEL5root | ec2-user
Ubuntu – ubuntu
Fedora – fedora | ec2-user
SUSE Linux – root | ec2-user

All Others OS’s – root | ec2-user  or check with your AMI provider.

user_name@public_dns_name

For Example
ssh -i /path/my-key-pair.pem ec2-user@ec2-121.compute-1.amazonaws.com

More information please refer to AWS Official User Guide.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

Leave a Reply

Your email address will not be published. Required fields are marked *