Start a Linux-based Instance
Prerequisites
Before you launch your instance there are some prerequisites that has to be met.
- Create/Import SSH KeyPairs.
- Createa new Security Group (required primarily to reach your instance via SSH) and keep the default one as it is.
- Create a Private Network and the router.
- (Optional for IPv4 subnets) Create a Floating IP to reach your instance from the outside world.
Launch a Linux-based Instance in Horizon Dashboard
Navigate to Project > Compute > Instances and click Launch Instance. The Launch Instance popup window will appear where you will find tabs and fields for configuring the settings of the newly created instance.
Details
In this tab you can configure the fundamental settings for your new virtual machine (VM).
- Project Name: This field is set with the name of your project and cannot be changed.
- Instance Name: Enter the name of your instance.
- Description: Provide a description of your instance.
- Availability Zone: Set to
NOVA
(you cannot change this field). - Count: Specify the number of instances you want to launch. Keep in mind that the maximum number of instances you can launch on behalf of one project is limited to 10 instances.
Once you've filled out the mandatory fields marked with the *
in the Details tab, you can proceed to the next configuration step by clicking Next at the bottom of the form or by selecting Source tab from the left panel of the popup screen.
Source
In this tab you specify the source for the operating system volume of your new virtual machine.
- Select Boot Source: Choose the source for your instance.
Image
: Boot from a pre-existing virtual machine image - a single file which contains a virtual disk that has a bootable operating system installed on it (recommended).Instance Snapshot
: Boot from a snapshot of another instance. Read more.Volume
: Boot from a volume. Read more.Volume Snapshot
: Boot from a snapshot of a volume. Read more.
Avialable: This section displays a list of available source linux images. You can browse and select the desired image for your VM.
Volume Size: After selecting desired image you will be able to set the Volume Size in GBs for the new volume. The minimum volume size is 20 GB, and the maximum size is set by your quotas.
Delete Volume on Instance Delete:
No
: the default value - the root volume is kept, and not deleted, even after the instance is deleted.Yes
: the root volume is deleted when the instance is deleted. Please only set it toYes
when you understand the consequences.
Flavor
Select the flavor that meets your instance vCPUs and RAM requirements.
Please ignore the 0
values in Total Disk, Root Disk, Ephemeral Disk columns. Disk is not used in our Openstack.
Networks
In this tab, you should choose one of your previously created private networks. If you haven't created a private network yet, please refer to Create Private Networks and create one before launching a new instance.
Security Group
The default
security group is automatically assigned to the new instance. In this security group, beside other instances that are also assigned to this security group all incoming traffic is blocked. If you want to allow any traffic to your instance, it is recommended to create your own security group with specific rules.
If you don't know how to create your own security group, please read Create and Manage Security Groups.
Key Pair
Add one of your previously created public SSH keys to your instance. If you have only one key pair created, it will be automatically added as shown in the screenshot below. If you haven't created your own key pair, please refer to SSH Keypairs.
After completing all the steps described above, you can click Launch Instance in the bottom right corner of the popup.
Congratulations! You have launched your new linux-based instance in OpenStack.
Launch a Linux-based Instance Using the OpenStack CLI
Standard Scenario
Ensure you're in the correct project by checking project_id
:
Example output
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires | 2024-10-14T22:45:55+0000 |
| id | gAAAAABnDPZjLK9Q5CFPMxa6i1Wy0B96F39oUkGSv47iolrx_W3I80CzVm99-DgJ5r9CVOt1hWPQ05O92p8sRLMM1INdI5oag-_ottK39Sg0ROv1y76z5NxWiwDVRE3OuZaxSTmlQeA0PtC_pC5O7qoVA8yGTi97XjQnceKsTFhLQvkB9rzZWGE |
| project_id | 91876c533032496fb2cdec6508a37022 |
| user_id | 43bb91a04c174ef6af8857a205768f20 |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
List the available images to boot your instance from to select the appropriate one for your needs:
Example output
+--------------------------------------+------------------------------+--------+
| ID | Name | Status |
+--------------------------------------+------------------------------+--------+
| c4bdfc3d-abec-40be-9df6-b4db99df269b | Debian 12 (Switch Cloud) | active |
| a228007f-0d2f-4505-b3e9-8541f727efb9 | Rocky Linux 9 (Switch Cloud) | active |
| d6ad78a1-21fb-4abb-82f3-450ac46a92a1 | Ubuntu 22.04 (Switch Cloud) | active |
| e8923f74-fe1b-43b8-8614-872cf891a0f3 | Ubuntu 24.04 (Switch Cloud) | active |
+--------------------------------------+------------------------------+--------+
List available flavors to select the appropriate one for your needs:
Example output
+--------+----------+--------+------+-----------+-------+-----------+
| ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
+--------+----------+--------+------+-----------+-------+-----------+
| 001001 | c001r001 | 1024 | 0 | 0 | 1 | True |
| 001002 | c001r002 | 2048 | 0 | 0 | 1 | True |
| 001004 | c001r004 | 4096 | 0 | 0 | 1 | True |
...
+--------+----------+--------+------+-----------+-------+-----------+
Now, you can launch a new instance by providing the necessary parameters, including name, image, flavor, network, and key-pair.
openstack server create \
--image my-image \
--flavor my-flavor \
--network my-network \
--security-group default \
--security-group ssh-access-group \
--key-name my-ssh-key \
--boot-from-volume <size-in-GB> \
--min 1 --max 1 \
my-instance
Explanation:
openstack server create
: the base command used to create a new server (instance).
-
image
: specifies the image from which the instance will boot. This should be the name or ID of an available image in your OpenStack environment (e.g., Ubuntu, CentOS, etc.). The image provides the operating system that will run on the instance. -
flavor
: defines the flavor to use for the instance, which sets the virtual hardware specs such as CPU, RAM, and disk size. The flavor must match the resources you wish to allocate to the instance. -
network
: attaches the instance to the specified network. This should be an existing network in your OpenStack environment where the instance will connect for internal or external communication. -
security-group
: attaches security groups to the instance. -
key-name
: associates an SSH key pair with the instance. The public part of this key is injected into the instance for secure SSH access. -
boot-from-volume
: creates a new volume of the specified size (in GB) and boots the instance from it. The volume will be based on the image specified by --image. The root disk of the instance will be stored on this volume, and the volume will persist even if the instance is deleted, unless explicitly removed. The minimum volume size is 20 GB, and the maximum size is set by your quotas. -
min 1 max 1
: these options define the minimum and maximum number of instances to create. In this case, the command is creating exactly 1 instance. -
my-instance
: this is the name you assign to the newly created instance. You can choose any valid name for your instance.
You can now check the status of the instance and ensure it is running:
Example output
+--------------------------------------+-------------+--------+------------------------------------- -----------+--------------------------+----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+-------------+--------+------------------------------------------ ------+--------------------------+----------+
| f946a80d-1e24-462e-a297-25293bc12f86 | my-instance | ACTIVE | my-network=192.168.11.163, 2001:620:6:e021::31a | N/A (booted from volume) | c001r001 |
+--------------------------------------+-------------+--------+--------------------------------------- ---------+--------------------------+----------+
Exceeding Quotas Scenario
Consider a scenario when launching more instances than your resource quotas allow:
Base conditions:
- 2 instances already active (
my-CLI-instance
,my-CLI-instance2
) - Instance limit: 10
- Volume limit: 10
The below command will try to provision from 1 to 11 instances depending on the resource availability:
openstack server create --image "Debian 12 (Switch Cloud)" \
--flavor c001r001 \
--network MKNetwork \
--security-group default \
--security-group MKSecurityGroup \
--key-name mykeycli \
--boot-from-volume 20 \
--min 1 --max 11 \
my-CLI-instance3to11
List the instances to check the results:
Example output
+--------------------------------------+------------------------+--------+------------------------------------------------+--------------------------+----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+------------------------+--------+------------------------------------------------+--------------------------+----------+
| 1239b91c-d3be-4f07-a4dd-a9beceaab9fc | my-CLI-instance3to11-1 | ACTIVE | MKNetwork=192.168.11.85, 2001:620:6:e021::13a | N/A (booted from volume) | c001r001 |
| 1a3e542b-e51b-4fee-be0b-17c194cc6a45 | my-CLI-instance3to11-2 | ACTIVE | MKNetwork=192.168.11.215, 2001:620:6:e021::20c | N/A (booted from volume) | c001r001 |
| 3df9b12f-3a8c-4b3e-827a-31ff7c55f4f7 | my-CLI-instance3to11-5 | ACTIVE | MKNetwork=192.168.11.179, 2001:620:6:e021::3aa | N/A (booted from volume) | c001r001 |
| 9589db74-3449-4a55-99ce-c70637033095 | my-CLI-instance3to11-6 | ACTIVE | MKNetwork=192.168.11.106, 2001:620:6:e021::c7 | N/A (booted from volume) | c001r001 |
| b395e046-3bd0-485a-9ded-7bad9ef12c95 | my-CLI-instance3to11-4 | ACTIVE | MKNetwork=192.168.11.177, 2001:620:6:e021::36c | N/A (booted from volume) | c001r001 |
| c18c9f85-d661-47f6-a98e-ef62a95b4dba | my-CLI-instance3to11-8 | ACTIVE | MKNetwork=192.168.11.66, 2001:620:6:e021::383 | N/A (booted from volume) | c001r001 |
| d2fa2a76-00b5-47e9-b9db-886432961f5a | my-CLI-instance3to11-7 | ERROR | | N/A (booted from volume) | c001r001 |
| e57d11fd-0360-45a1-9d83-e21c2800f76b | my-CLI-instance3to11-3 | ACTIVE | MKNetwork=192.168.11.166, 2001:620:6:e021::a9 | N/A (booted from volume) | c001r001 |
| 525f7b2c-6d71-4123-988f-e637e383fbd6 | my-CLI-instance2 | ACTIVE | MKNetwork=192.168.11.150, 2001:620:6:e021::1b | N/A (booted from volume) | c001r001 |
| f946a80d-1e24-462e-a297-25293bc12f86 | my-CLI-instance | ACTIVE | MKNetwork=192.168.11.163, 2001:620:6:e021::31a | N/A (booted from volume) | c001r001 |
+--------------------------------------+------------------------+--------+------------------------------------------------+--------------------------+----------+
8 instances were created because of the instance limit set to 10. Notice the naming convention. Let's examine the my-CLI-instance3to11-7
instance because of the ERROR
status.
Use the below command to get detailed information about the instance:
Example output
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ...
| OS-EXT-SRV-ATTR:hostname | my-cli-instance3to11-7 ...
| fault | {'code': 500, 'created': '2024-10-15T09:30:16Z', 'message': "Build of instance d2fa2a76-00b5-47e9-b9db-886432961f5a aborted: VolumeLimitExceeded: Maximum number of volumes allowed (10) exceeded for quota 'volumes'."} |
| flavor | description=, disk='0', ephemeral='0', , id='c001r001', is_disabled=, is_public='True', location=, name='c001r001', original_name='c001r001', ram='1024', rxtx_factor=, swap='0', vcpus='1' |
... |
| volumes_attached | |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
We can see that 8 instances were created with openstack server create
command previously because of the max instances limit (2 out of 10 were already used). By examining details about my-CLI-instance3to11-7
we can notice the ERROR
status is because volume limit has been exceeded. To check the quotas and list volume to confirm this we can use the below commands. Notice one volume is listed as available - in this scenario it was a remnant of a previously terminated instance. As mentioned before, the volume will persist even if the instance is deleted, unless explicitly removed.
Show the quotas:
Example output
+--------------------------------+-------+
| Resource | Limit |
+--------------------------------+-------+
| cores | 20 |
| instances | 10 |
| ram | 51200 |
| fixed_ips | None |
| networks | 100 |
| volumes | 10 |
| snapshots | 10 |
| gigabytes | 1000 |
...
+--------------------------------+-------+
List volumes:
Example output
+--------------------------------------+------+-----------+------+-------------------------------------------------+
| ID | Name | Status | Size | Attached to |
+--------------------------------------+------+-----------+------+-------------------------------------------------+
| e1ac8a97-366a-488b-afb9-35837ba5ba46 | | in-use | 20 | Attached to my-CLI-instance3to11-1 on /dev/sda |
| dde61abb-99f2-4788-b596-b2fa2d4f227d | | in-use | 20 | Attached to my-CLI-instance3to11-5 on /dev/sda |
| 9fed116a-50e5-47e2-ab21-7a7c55eb10ed | | in-use | 20 | Attached to my-CLI-instance3to11-6 on /dev/sda |
| 99a5514c-1650-4b22-ac03-2fbfc629769b | | in-use | 20 | Attached to my-CLI-instance3to11-4 on /dev/sda |
| 8e3ae783-23e1-45fd-9ed8-01c20f39f635 | | in-use | 20 | Attached to my-CLI-instance3to11-8 on /dev/sda |
| 66f13145-1f7f-43e5-9f86-e640465defdd | | in-use | 20 | Attached to my-CLI-instance3to11-3 on /dev/sda |
| 2a5a8e98-87ac-4868-ad66-f3dfd5a32a60 | | in-use | 20 | Attached to my-CLI-instance3to11-2 on /dev/sda |
| 563fcad7-9579-48cd-aaec-ed916d5adf7b | | in-use | 20 | Attached to my-CLI-instance2 on /dev/sda |
| 83d11c7a-d11f-4fb1-b74a-ce85f3fcd5d6 | | in-use | 20 | Attached to my-CLI-instance on /dev/sda |
| 7ce45df7-90f2-405d-8f01-dfc4fa2dfda5 | | available | 25 | |
+--------------------------------------+------+-----------+------+-------------------------------------------------+