When you connect to an ssh server, your ssh client stores a list of trusted hosts in the form of key-value pairs for the IP address and fingerprint of the ssh server. With ec2, you often reuse the same IP address with multiple server instances, which causes a conflict.
If you connect to an earlier instance of ec2 with this IP address and now connect to a new instance with the same IP address, your computer will complain of a “Host Verification Error” because its previously saved pair no longer matches the new pair.
The error message tells you how to fix it:
for example: RSA key violation in /home/ubuntu/.ssh/known_hosts:1 remove with: ssh-keygen -f "/home/ubuntu/.ssh/known_hosts" -R
just open /home/ubuntu/.ssh/known_hosts and delete line 1 (as indicated by ": 1").
Now you can connect and get a new host check
source share