and leave ssh_ec2nf as doing ssh -o "StrictHostKeyChecking=yes" -o "HostKeyAlias=ec2nf" "$ADDR" while still having git, scp, etc work with $ADDR. If “I want to connect to these instances in an ad-hoc manner not already covered by my shell scripts” is a problem you ever run into. I kind of doubt it is, I was mainly responding to the “I don’t see how” part of your comment rather than claiming that doing so would be useful.
If you were to edit
~/.ssh/known_hoststo add an entry for each EC2 host you use, but put them all under the aliasec2, that would work.So your
~/.ssh/known_hostswould look likeThat would mean that host key checking only works to say “is this any one of my ec2 instances” though.
Edit: You could also combine the two approaches, e.g. have
and leave
ssh_ec2nfas doingssh -o "StrictHostKeyChecking=yes" -o "HostKeyAlias=ec2nf" "$ADDR"while still having git, scp, etc work with$ADDR. If “I want to connect to these instances in an ad-hoc manner not already covered by my shell scripts” is a problem you ever run into. I kind of doubt it is, I was mainly responding to the “I don’t see how” part of your comment rather than claiming that doing so would be useful.