Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I`m new to EC2 and I'm having some problems setting up my first instance. I followed this guide: 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 ( I can't load the page. I tried running the command

ssh -i ec2-keypair

but received this message in the terminal:

ssh: Could not resolve hostname nodename nor servname provided, or not known

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

share|improve this question
up vote 6 down vote accepted

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

ssh -i ec2-keypair

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

share|improve this answer
Actually, it turns out I also need to use ec2-user instead of root, so it will be: ssh -i ec2-keypair – ThePiachu Oct 8 '11 at 18:59
You can also put the EC2 keypair in your ~/.ssh/config. – ceejayoz Oct 8 '11 at 18:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.