3.2. Manage Instance Security
You can manage access to an instance by assigning it the correct security group (set of firewall rules) and key pair (enables SSH user access). Further, you can assign a floating IP address to an instance to enable external network access. The sections below outline how to create and manage key pairs and floating IP addresses. For information on managing security groups, see Section 2.1.5, “Manage Project Security”.
3.2.1. Manage Key Pairs
Key pairs provide SSH access to the instances. Each time a key pair is generated, its certificate is downloaded to the local machine and can be distributed to users. Typically, one key pair is created for each project (and used for multiple instances).
You can also import an existing key pair into OpenStack.
3.2.1.1. Create a Key Pair
- In the dashboard, select Project > Compute > Access & Security.
- On the Key Pairs tab, click .
- Specify a name in the Key Pair Name field, and click .When the key pair is created, a key pair file is automatically downloaded through the browser. Save this file for later connections from external machines. For command-line SSH connections, you can load this file into SSH by executing:
#ssh-add ~/.ssh/OS-Key.pem
3.2.1.2. Import a Key Pair
- In the dashboard, select Project > Compute > Access & Security.
- On the Key Pairs tab, click .
- Specify a name in the Key Pair Name field, and copy and paste the contents of your public key into the Public Key field.
- Click .
3.2.1.3. Delete a Key Pair
- In the dashboard, select Project > Compute > Access & Security.
- On the Key Pairs tab, click the key's button.
3.2.2. Create, Assign, and Release Floating IP Addresses
By default, an instance is given an internal IP address when it is first created. However, you can enable access through the public network by creating and assigning a floating IP address (external address). You can change an instance's associated IP address regardless of the instance's state.
Projects have a limited range of floating IP address that can be used (by default, the limit is 50), so you should release these addresses for reuse when they are no longer needed. Floating IP addresses can only be allocated from an existing floating IP pool (see Section 5.2.1, “Create Floating IP Pools”).
Procedure 3.4. Allocate a Floating IP to the Project
- In the dashboard, select Project > Compute > Access & Security.
- On the Floating IPs tab, click .
- Select a network from which to allocate the IP address in the Pool field.
- Click .
Procedure 3.5. Assign a Floating IP
- In the dashboard, select Project > Compute > Access & Security.
- On the Floating IPs tab, click the address' button.
- Select the address to be assigned in the IP address field.NoteIf no addresses are available, you can click the button to create a new address.
- Select the instance to be associated in the Port to be Associated field. An instance can only be associated with one floating IP address.
- Click .
Procedure 3.6. Release a Floating IP
- In the dashboard, select Project > Compute > Access & Security.
- On the Floating IPs tab, click the address' menu arrow (next to the button.
- Select Release Floating IP.