Ask Your Question

Add keypair to running vm [closed]

asked 2017-01-19 03:36:00 -0500

tcpip gravatar image

updated 2017-01-20 00:52:05 -0500


I was looking how I can add a keypair to a running VM, for all the searches I did, this will not be possible, please can someone confirm this is true or is there any work around.

Please can you share the steps?


@Bernd Bausch's Thanks for you update I will work with that.

Thanks again.


edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by tcpip
close date 2017-01-20 00:52:28.474592

2 answers

Sort by ยป oldest newest most voted

answered 2017-01-19 18:18:32 -0500

When you provide the name of a keypair at instance launch, Nova puts the public key into the instance's metadata. The instance then retrieves the key via the metadata API or the config drive. The usual retrieval method is a software package named cloud-init which is included in most cloud images.

If you need to give the instance an SSH key at a later time, you need a channel to the instance (socket, shared file, whatever) through which you can submit the key and a process on the instance that retrieves the key and adds it to the authorized_keys file. So you have to invent a solution, and it is indeed very "manual".

While you can add metadata to a running instance, a metadata item is limited to 255 bytes, and SSH keys are longer.

edit flag offensive delete link more

answered 2017-01-19 05:56:32 -0500

Moorthy gravatar image

Yes. You have to use manual steps to add keypair to a running VM.

Cloud-init supports injecting keypair during the creation creation (ie) first boot of the instance only.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2017-01-19 03:36:00 -0500

Seen: 7,204 times

Last updated: Jan 20 '17