Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to login to ec2 machine?

Tags:

ssh

amazon-ec2

I was given some login information for an EC2 machine, basically an ec2-X-X-X.compute-X.amazonaws.com plus a username and password.

How do I access the machine? I tried sshing:

ssh [email protected]

but I get a Permission denied, please try again. when I enter the password. Is sshing the right way to access the EC2 machine? (Google hits I found suggested that you could ssh into the machine, but they also used keypairs.) Or is it more likely that the problem is that I was given invalid login credentials?

like image 203
grautur Avatar asked May 07 '11 00:05

grautur


1 Answers

If you are new to AWS and need to access a brand new EC2 instance via ssh, keep in mind that you also need to allow incoming traffic on port 22.

Assuming that the EC2 instance was created accepting all the default wizard suggestions, access to the machine will be guarded by the default security group, which basically prohibits all inbound traffic. Thus:

  1. Go to the AWS console
  2. Choose Security Groups on the left navigation pane
  3. Choose default from the main pane (it may be the only item in the list)
  4. In the bottom pane, choose Inbound, then Create a new rule: SSH
  5. Click Add rule and then Apply Rule Changes

Next, assuming that you are in possession of the private key, do the following:

$ chmod 600 path/to/mykey.pem $ ssh -i path/to/mykey.pem [email protected] 

My EC2 instance was created from a Ubuntu 32-bit 12.04 image, whose configuration does not allow ssh access to root, and asks you to log in as ubuntu instead:

$ ssh -i path/to/mykey.pem [email protected] 

Cheers, Giuseppe

like image 148
Giuseppe Avatar answered Nov 10 '22 11:11

Giuseppe