Amazon EC2 – Troubleshooting SSH Problems on EC2 Instances

amazon ec2cloudserver-setup

I`m new to EC2 and I'm having some problems setting up my first instance. I followed this guide:
http://www.robertsosinski.com/2008/01/26/starting-amazon-ec2-with-mac-os-x/
with the difference that I used

ec2-run-instances --instance-type t1.micro ami-7f418316 -k ec2-keypair

to create my instance. When I try going to the public dns provided (ec2-107-22-254-80.compute-1.amazonaws.com) I can't load the page. I tried running the command

ssh -i ec2-keypair root@ec2-107-22-254-80.compute-1.amazonaws.com/

but received this message in the terminal:

ssh: Could not resolve hostname ec2-107-22-254-80.compute-1.amazonaws.com/: nodename nor servname provided, or not known

How do I properly set up a free micro instance on EC2?

Best Answer

You need to leave the trailing slash off of the hostname when you ssh. I.e.,

ssh -i ec2-keypair root@ec2-107-22-254-80.compute-1.amazonaws.com

Tip: Instead of asking Amazon to create your ssh keypair for you, you can upload your own ssh public key to EC2. This makes the ssh command much easier as you don't have to always specify "-i ec2-keypair".

I wrote an article that describes how to set this up:

Uploading Personal ssh Keys to Amazon EC2
http://alestic.com/2010/10/ec2-ssh-keys

Related Topic