Question

I use a private AMI in a cloudformation template, which also assigns a Route53 record to the new instance. Every time I connect to that hostname I get the "remote host identification has changed" and need to remove the offending key.

It seems that the host key is changed when the instance is launched, but since the AMI is only accessible by me, I'd like to setup the instance creation in a way that would allow the host key to stay the same (and get rid of that warning).

Is that possible?

Was it helpful?

Solution

I'd like to setup the instance creation in a way that would allow the host key to stay the same (and get rid of that warning).

Is that possible?

Do you want the hostname to stay the same, or do you want the message to go away?

Short answer: The hostname will not stay the same across instances. A new instance is a new instance. However, if you're connecting over SSH (you didn't specify), you can use something like:

ssh -q -o "BatchMode=yes" -o "StrictHostKeyChecking=no" -i ~/.ssh/{keypair}.pem ec2-user@{hostname}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top