Failed to connect to ssh after recovering an ec2 snapshot

Solution 1
1. Use verbose mode to see the error

ssh -v

2. Delete the corresponding row in ~/.ssh/known_hosts


Solution 2
1. Detach the volume
2. Create a temporary ec2 instance and attach the volume into it
3. Login to the temporary ec2 instance
4. Check the device code


5. Mount the volume (/dev/xvdg)

mkdir mount_point
mount /dev/xvdg1 mount_point

6. Change the ssh config.
7. Attach the volume back to the original ec2 instance
8. Delete the temporary ec2 instance
9. Delete the corresponding row in ~/.ssh/known_hosts and try again