This error says that something has changed since you last logged into this server and that the server you are trying to run ssh on may not be the server that you think is .
One thing to know about ... When you create an EC2 instance, There is no fixed IP assigned to this instance .
When you run this instance, it will get the (dynamic) IP number and DNS name, which will be based on this IP address.
If you close the instance and start it after a few hours, it can get a new IP address and a new DNS name .
If you are still trying to access the old DNS name / IP , you are actually trying to access a server that may not belong to you.
This will end with the same msg error you have.
(This may happen because you pointed the DNS record to the old IP address or you are using scripts trying to access the old DNS name / IP address, or just repeat the ssh command from your history ...)
If so, the solution should use Elastic IP .
You can assign Elastic IP to your server, and this will force it to maintain its IP address between reboots.
The elastic IP address is free while your (connected) server is down.
But it will cost you a small fee if the connected server is down.
This is to ensure that you do not βreserveβ IP until you use / need it.
source share