Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you still have that actual keypair working, you could create a script that executes ssh commands into each instance, injects the new key into ~/.ssh/authorized_keys and then remove the old key.

Something like:

ssh user@server echo "NEW KEY" >> ~/.ssh/authorized_keys
ssh user@server "sed -i.bak '/OLD KEY/d' ~/.ssh/authorized_keys"

If you still have that actual keypair working, you could create a script that executes ssh commands into each instance, injects the new key into ~/.ssh/authorized_keys and then remove the old key.

Something like:

ssh user@server echo "NEW KEY" >> ~/.ssh/authorized_keys
ssh user@server "sed -i.bak '/OLD KEY/d' ~/.ssh/authorized_keys"

You could create a list of all instance IPs you have or fetch the instance IPs using Openstack API though this would be more advanced.