I need SSH access to an Amazon EC2 instance running Ubuntu 10.4. All I have is the Amazon username and password. Any ideas?
To setup Ubuntu on AWS, please follow the following steps:
To access the instance via SSH, run:
Connect to Linux box by specifying your PEM file, e.g.
ssh -i "file.pem" ubuntu@x.x.x.x
Make sure your PEM file has 600 permission (chmod 600 file.pem
).
If you're running VPC instance, and your security group is correct (with the right rules) and it still doesn't work, in VPC section check your subnet which should be attached to your VPC (both used by your instance) and setup new rule in Route Table that has 0.0.0.0/0
as Destination and your Internet Gateway as Target.
For more details check: Troubleshooting Connecting to Your Instance
See also: Possible reasons for timeout when trying to access EC2 instance
Basically, you need a private-key file to login into your EC2 via SSH. Follow these steps to create one:
ssh -i /path/to/private-key root@<ec2-public-dns-address>
- the root username has been avoided in the latest releases, based on your distribution select ec2-user
or ubuntu
as your username.STEP 1) Download private keys assigned to your ec2 machine (which is only one time download when created. so recommended to commit somewhere)
STEP 2) and fire following commands,
chmod 400 MyKeyPair.pem
ssh -i MyKeyPair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com
Official Doc : Connecting to Your Linux/Unix Instances Using SSH
Note, the current user for 13.04 is "ubuntu" ssh -i ./mykey.pem ubuntu@ec2-xxx-xxx-xxx-1.compute-1.amazonaws.com
Make sure these thing in check
private key must have 400 permission
Make sure port 22 is open for AWS instance you are trying to access.
ssh -i privatekey.pem ubuntu@XXX.XXX.XXX.XXX
// XXX.XXX.XXX.XXX = your instance public ip1) First chmod
the .pem file
for restricting the file permissons as below
chmod 400 my-key-pair.pem
2)Then
ssh
with the following commands directly from .ssh
folder
ssh -i my-key-pair.pem ec2-user@ec2-198-99-90-3.compute-1.amazonaws.com
Note:- To navigate into .ssh
folder. First press Ctrl + H
to display all the hidden files and finallycd .ssh