Finally, now that we can access an instance, we don't want to do that
by providing passwords each time. Let's see how Secure Shell keys can
avoid doing this.
I mentioned already in passing that cloud instances most likely don't
have passwords on their accounts, that is usually so because if you
have a few thousand instances, normally you cannot remember all their passwords.
So what you usually do is you create a Secure Shell key pair,
for example, using the command ssh-keygen.
And then you have to copy the public part of that key pair to all
those instances where you want to use it, for example,
using this little utility ssh-copy-id. I still have to provide the
password once, and now I can, I can access the instance without
providing my password thanks to the SSH protocol.
Now we still had to upload the key and provide the password,
and in order to prevent that, our instance should really be started
with the key on it, and OpenStack allows us to do that.
Let me launch another instance, another web server, and I'm going to
now give it the same image, and also the same flavor, and the same
network obviously, and since we plan to log onto it, I think we should
also give it a security group immediately.
I'm selecting the existing SSH security group here.
The next section is the key pair section.
I have the choice to create a new one or to import one.
Since I just created a key pair, I will import it.
I need the public key now, pick it up, and paste it there in the
Public Key field. And of course I have to give that thing a name,
a very poetic name here. So now OpenStack knows about my key,
and whenever it launches this instance, the key pair, or the public
key will already be loaded onto that instance.
I just notice the name, I gave it the same name as the other web server.
That is possible, but I don't want this to be, so I just change the name quickly.
And finally, we also need a floating IP, and we do exactly the same
thing as before, and create a new one from the public pool,
and we associate it with that new instance.
So the instance is running, let's try if we can actually access it.
And as you can see, no need to provide a password.