ec2インスタンスの実態が変わるたびに、known_hostsを削除する必要が出てきます。
めんどくさくなってGoogle検索していたら解決策がありました。
~/.ssh/config に以下を記述します。
Host *.amazonaws.com
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
これでec2のHostKey(サーバ側のkey)をチェックしないで、クライアントのknown_hostsにも書き込みません。
ただ、 man in the middle が可能になります。
クライアントからサーバへの経路のどこかで、サーバをなりすますことができれば、偽物のサーバにログインしていてもクライアントは気づかないことになります。
クライアント <=> 悪いやつ(man) <=> サーバ
そのリスクを理解して設定するか、消すかです。
あとは、以下のようにコマンドラインから消すことも可能です。
$ssh-keygen -R "ec2-wantremovecode.amazon.com"