Skip to Content
Hybrid Cloud for Developers
book

Hybrid Cloud for Developers

by Manoj Hirway
April 2018
Intermediate to advanced content levelIntermediate to advanced
280 pages
8h 37m
English
Packt Publishing
Content preview from Hybrid Cloud for Developers

Creating an SSH key-pair

When an OpenStack virtual machine is launched, you need an SSH key-pair to log in to the virtual machine.

In the following code, we first determine if there's already an existing keypair with the same name. If there isn't, we invoke the create_keypair() function of the compute class and pass the name of the keypair that we want to create. This function returns a keypair object, which can be used to extract the private key. We then write this private key to a local file. You may choose to write this file in your .ssh folder in your home directory:

def create_keypair(conn):     keypair_name = "packtpub-keypair"    # The name of the keypair to be created private_key_file = "private.key" # The name of the file that stores the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hybrid Cloud for Architects

Hybrid Cloud for Architects

Alok Shrivastwa
OpenStack: Building a Cloud Environment

OpenStack: Building a Cloud Environment

Alok Shrivastwa, Sunil Sarat, Kevin Jackson, Cody Bunch, Egle Sigler, Tony Campbell

Publisher Resources

ISBN: 9781788830874Supplemental Content