I'm trying to configure an EC2 with known SSH host keys on boot using cloud-init in a cloudformation template. But now I can't SSH into the server. It's tricky to debug :-)
Here's the userdata part of my EC2 fragment from my template:
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"#cloud-config", "\n",
"ssh_keys:", "\n",
"- rsa_private: |", "\n",
" -----BEGIN RSA PRIVATE KEY-----", "\n",
" MIIEowCBAAKCAQF71D8K9C/+K0a2fO+S9s441kSI44lF5ml++ewD+Mp115x9", "\n",
" /XwwTlvqxCIpxdzpzq4xXEqH48StHyYIjAOPxoS1/QG0Ti6OqU893PpukLdmV", "\n",
" kLZKn2ph4fTT2aMl...", "\n",
" -----END RSA PRIVATE KEY-----", "\n",
"rsa_public: ssh-rsa AAAAB...", "\n",
I also have entries for (ec)dsa_public/private as per the docs.
Is there some weirdness with cloudinit where I have to also specify ssh_authorized_keys as well? I assume my keypair's public key isn't now being pushed onto my EC2 by Amazon...