2

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).
2
  • 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, 2011 at 23:57
  • I did not change anything and didn't reboot either.
    – theduke
    Feb 21, 2011 at 0:00

2 Answers 2

1

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.

1

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:

https://forums.aws.amazon.com/message.jspa?messageID=95268

2
  • That thread says an hour is abnormal and that it should be no more than a few minutes.
    – ceejayoz
    Feb 2, 2012 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. Feb 3, 2012 at 14:37

You must log in to answer this question.

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