On EC2, when does the host key change?

Ladlestein asked:

I have an instance on EC2 that I think I Stopped at one point or another. When I restart it and tried to ssh in, I got those messages about the host key having changed. But why?

Is it because the Elastic IP I’d associated with the instance had to be remapped to it?

Shouldn’t the host key be generated once, and not be regenerated on the same host?

My answer:

The ssh key is never regenerated on the same host.

You are seeing this message because you previously had your Elastic IP connected to a completely different instance.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.