How to Launch an OpenStack Instance using Horizon Dashboard
This article is the third part of our OpenStack series. In this tutorial, we will go through steps to launch an OpenStack instance from Horizon Dashboard.
Prerequisites
1: Install Single Node OpenStack in CentOS 7 / RHEL 7
2: Configure OpenStack Networking to Enable Access to VM Instances
Launch OpenStack Instance
Before launching an instance, we would need to perform the below tasks.
- Create OpenStack Image
- Create Machine Flavor
- Create Security Group
- Generate Key Pair
Create OpenStack Image
Without virtual machine images, you can not deploy OpenStack instances. OpenStack Image is a single file (QCOW2 or Raw) which contains a disk that has an operating system installed on it.
For this demo, we will use CentOS 6 image and upload it to OpenStack.
In case you want to use some other image, get it from here.
Login as admin user and perform the below tasks.
To Create Image, Go to Admin >> Compute >> Images >> + Create Image.
Enter the details.
Image Name: CentOS 6 x86_64
Image Description: CentOS 6 Image
Image Source: Browse the downloaded image (My image is in ~/raj – Home directory).
![Launch an OpenStack Instance - Browse OpenStack Image](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Browse-OpenStack-Image-1024x690.png)
Format: QCOW2 – QEMU Emulator
![Launch an OpenStack Instance - Create OpenStack Image](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Create-OpenStack-Image-1-1024x689.png)
Click Create Image to begin. Wait for few minutes to complete.
![Launch an OpenStack Instance - OpenStack Image Creation in Progress](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-OpenStack-Image-Creation-in-Progress-1024x690.png)
Note: Image will be accessible to all OpenStack users, by default.
Create Machine Flavor
Machine Flavors are varying combinations of CPU, memory, storage and swap capacity and let you choose the correct mix of resources for your requirement.
Though OpenStack has predefined flavors creating a new machine flavor could match the exact resource requirement for your application.
Let us create a flavor for 1VCPU, 1GB RAM, and 10GB Disk.
Go to Admin >> Compute >> Flavors >> + Create Flavor. You should be in OpenStack admin login.
Flavor details,
Name: custom.small
VCPUs: 1
RAM: 1024
Root Disk: 10 GB
![Launch an OpenStack Instance - Create Machine Flavor](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Create-Machine-Flavor-1024x688.png)
Note: Any OpenStack user can use this flavor to create instances, by default.
Create Security Group
OpenStack security group acts as a virtual firewall that controls the connection to/from instances. Security groups should be created to allow connections like SSH, HTTP, HTTPS, etc.
Here, we will create a security group to allow ICMP and SSH connections.
Login as a normal user “raj”.
![Configure OpenStack Networking - OpenStack User Login](https://www.itzgeek.com/wp-content/uploads/2018/01/Configure-OpenStack-Networking-OpenStack-User-Login-1024x543.png)
Go to Project >> Network >> Security Groups >> + Create Security Group.
In this page, name your security group and click Create Security Group.
![Launch an OpenStack Instance - Create Security Group](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Create-Security-Group-1-1024x441.png)
Now, click Manage Rules of the newly created group.
![Launch an OpenStack Instance - Manage Security Rules](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Manage-Security-Rules-1024x477.png)
Add a rule something like below.
Project >> Network >> Security Groups >> Security Group (ITzGeek_Security) >> Manage >> + Add Rule.
SSH:
Rule: SSH / ICMP
Remote: CIDR
CIDR: 0.0.0.0/0
![Launch an OpenStack Instance - Add SSH Rule](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Add-SSH-Rule-1024x566.png)
ICMP:
Rule: All ICMP
Direction: Ingress
Remote: CIDR
CIDR: 0.0.0.0/0
![Launch an OpenStack Instance - Add ICMP Rule](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Add-ICMP-Rule-1024x550.png)
Create Key Pair
The key pair is the public key which is used for accessing the created instances. Without the key pair, we can not access the instance.
Go to Project >> Compute >> Key Pairs >> + Create Key Pair.
![Launch an OpenStack Instance - Create Key Pair](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Create-Key-Pair-1024x430.png)
Use Right click and Copy or Click Copy Private Key to Clipboard and save the key pair to the file (in my case, it is ITzGeek-Key) for future use.
![Launch an OpenStack Instance - Copy Private Key](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Copy-Private-Key-1024x584.png)
Now, we are ready to launch an instance.
Launch an instance
Go to Project >> Compute >> Instances >> Launch Instance.
Name your instance and click next.
![Launch an OpenStack Instance - Create OpenStack VM](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Create-OpenStack-VM-1024x574.png)
Select the uploaded (CentOS 6 x86_64) image as the source for this instance.
![Launch an OpenStack Instance - Choose VM Image](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Choose-VM-Image-1-1024x604.png)
We will use our custom.small flavor so that OpenStack can allocate resources easily for us.
![Launch an OpenStack Instance - Choose Machine Flavor](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Choose-Machine-Flavor-1024x601.png)
Choose the Internal_Network.
![Launch an OpenStack Instance - Choose Network](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Choose-Network-1024x572.png)
Select the security group we created earlier.
![Launch an OpenStack Instance - Choose Security Group](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Choose-Security-Group-1-1024x558.png)
Make sure you select the correct key pair. Finally, click Launch Instance to begin the instance creation.
![Launch an OpenStack Instance - Select Key Pair & Launch Instance](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Select-Key-Pair-Launch-Instance-1024x596.png)
Wait for few minutes. The instance should be up and run in few minutes.
![Launch an OpenStack Instance - VM Instances](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-VM-Instances-1024x412.png)
Once the instance is up, assign a floating IP to the instance so that we can access the instance. Click Associate Floating IP.
![Launch an OpenStack Instance - Assign Floating IP to VM](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Assign-Floating-IP-to-VM-1024x581.png)
Click + sign.
![Launch an OpenStack Instance - Manage Floating IP Association](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Manage-Floating-IP-Association-1-1024x412.png)
Use External_Network and then click Associate IP.
![](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Choose-Allocation-Network-1024x431.png)
Finally, click Associate.
![Launch an OpenStack Instance - Map the IP](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-Map-the-IP-1024x448.png)
Your instance should have a floating IP address assigned to it.
![Launch an OpenStack Instance - OpenStack Instance Running with Floating IP](https://www.itzgeek.com/wp-content/uploads/2018/01/Launch-an-OpenStack-Instance-OpenStack-Instance-Running-with-Floating-IP-1024x433.png)
Access OpenStack Instance
Wait for few seconds and try ping to the floating IP address. You should get a ping response.
ping 192.168.201 -c 2
![Ping VM Instance](https://www.itzgeek.com/wp-content/uploads/2018/01/Ping-VM-Instance.png)
As I said already, I have saved Key pair in the file called “ITzGeek-Key“. When I save a file, it saved in 644 permission. The file permission should be changed to 600 for using with SSH for connecting to OpenStack instance.
chmod 600 ITzGeek-Key
![Change Key Pair Permission](https://www.itzgeek.com/wp-content/uploads/2018/01/Change-Key-Pair-Permission.png)
Now try accessing the instance using the floating IP with the created key pair.
The default username for CentOS cloud image is centos.
ssh -i ITzGeek-Key [email protected]
Type yes to connect to the instance as you are connecting for the first time.
You should now be in the terminal of the newly created instance.
![Connect OpenStack VM Instance](https://www.itzgeek.com/wp-content/uploads/2018/01/Connect-OpenStack-VM-Instance.png)
That’s All.