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 Linux – ec2-user
RHEL5 – root | 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.
ssh -i /path/my-key-pair.pem email@example.com
More information please refer to AWS Official User Guide.