Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 created a new Amazon Linux AMI instance and could connect just fine via ssh. Then I assigned an elastic IP to the instance and ssh suddenly stopped working.

Debug output:

debug1: Trying private key: theduke.pem
debug1: read PEM private key done: type RSA
debug3: sign_and_send_pubkey
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
share|improve this question
did you reboot? check that the instance didn't change at all. sometimes the machine name you ssh into will change when you make changes to your instance and reboot. You may need to recreate your keys. – egorgry Feb 20 '11 at 23:57
I did not change anything and didn't reboot either. – theduke Feb 21 '11 at 0:00

Check associating an Elastic IP address with a running instance:

  • login in AWS Management Console
  • click EC2 tab
  • Instances in the Navigation
  • write down the instance ID
  • click Elastic IPs in the Navigation
  • select an instance and click Associate

Also check login when use ssh.

share|improve this answer

I experienced this myself and found there's a very simple answer. Patience. It may take up to an hour for the machine to be accessible via ssh, even when using the correct credentials and the new IP address. See this related thread about the topic where another AWS user goes over it with Amazon support:

share|improve this answer
That thread says an hour is abnormal and that it should be no more than a few minutes. – ceejayoz Feb 2 '12 at 18:50
In my experience, it too more than a few minutes. However, since I wasn't monitoring it continuously, I don't know exactly when the transition completed, but I did check it several times in the first few minutes. – Mark Stosberg Feb 3 '12 at 14:37

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.