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 [email protected]/

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?

1 Answer 1


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

ssh -i ec2-keypair [email protected]

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

  • Actually, it turns out I also need to use ec2-user instead of root, so it will be: ssh -i ec2-keypair [email protected]
    – ThePiachu
    Commented Oct 8, 2011 at 18:59
  • 1
    You can also put the EC2 keypair in your ~/.ssh/config.
    – ceejayoz
    Commented Oct 8, 2011 at 18:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .