1

I have successfully made an AMI and able to launch instances from this image from my AWS account successfully. However, as soon as I try to launch an instance from this AMI from some other AWS account specifying keypair other than whats in the AMI authorized_keys already, it doesn't let me login to instance with the new keypair(for obvious reasons). I am assuming that i need to implement some sort of mechanism to download the custom keypair specified in the instance creation wizard of Amazon AWS into the authorized_keys of the newly created instance.

Looking for hints on how this can be achieved !!

Thanks.

2

Take a loot at https://help.ubuntu.com/community/CloudInit.

You need to set up the AMI with it and it will update the authorized key.

It's also available at other distros.

You can also make a script (for instance rc.local) and grab the value at:

curl http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key

Amazon exposes lots of information through metadata.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.