How to create a VM using the OpenStack CLI client on WEkEO Elasticity cloud
This article will cover creating a virtual machine on WEkEO Elasticity WAW3-1 cloud using the OpenStack CLI client only. It contains basic information you need to get started.
What We Are Going To Cover
Gathering information which will be used to create a virtual machine
Creating a virtual machine (including using a user-uploaded Debian image to create a VM as an example)
Prerequisites
No. 1 Account
You need a WEkEO Elasticity hosting account with access to the Horizon interface: https://horizon.cloudferro.com.
No. 2 OpenStack CLI client configured
You need to have the OpenStack CLI client configured and operational. This article contains information on how to achieve this purpose: How to install OpenStackClient for Linux on WEkEO Elasticity. You can test whether your OpenStack CLI is properly activated by executing the openstack server list command mentioned in the end of that article - it should return the list of your virtual machines.
No. 3 Uploaded public SSH key
If the image you wish to use requires you to attach an SSH key while creating your virtual machine, it will need to be uploaded to WEkEO Elasticity WAW3-1 cloud. One of these articles should help:
Always use the latest value of image id
From time to time, the default images of operating systems in the WEkEO Elasticity cloud are upgraded to the new versions. As a consequence, their image id will change. Let’s say that the image id for Ubuntu 20.04 LTS was 574fe1db-8099-4db4-a543-9e89526d20ae at the time of writing of this article. While working through the article, you would normally take the current value of image id, and would use it to replace 574fe1db-8099-4db4-a543-9e89526d20ae throughout the text.
Now, suppose you wanted to automate processes under OpenStack, perhaps using Heat, Terraform, Ansible or any other tool for OpenStack automation; if you use the value of 574fe1db-8099-4db4-a543-9e89526d20ae for image id, it would remain hardcoded and once this value gets changed during the upgrade, the automated process may stop to execute.
Warning
Make sure that your automation code is using the current value of an OS image id, not the hardcoded one.
Step 1: Gather information which will be used to create your virtual machine
Choose an image
In this article we will use an image as a source for your virtual machine. It can be one of the following:
Default images on WEkEO Elasticity WAW3-1 cloud
Images which were shared with you from other projects and which you accepted
Images you uploaded yourself, for example, by following this article: How to upload your custom image using OpenStack CLI on WEkEO Elasticity
Other sources are outside of scope of this article.
You can execute the following command to see those images:
openstack image list
You should get the output like this:
In this example, we can see the default images available on the cloud and image called Debian-test uploaded by the user.
While creating your virtual machine using the openstack server create command, you will pass the name or ID of the image of your choice using the --image parameter.
Flavor
Flavors determine hardware available to the virtual machine. You can list flavors available to you using this command:
openstack flavor list
Choose the flavor that suits you best. While creating your virtual machine using the openstack server create command, you will pass the ID or name of the flavor you chose using the --image parameter.
Please note that the following flavors contain access to NVIDIA GPU:
vm.a6000.1
vm.a6000.2
vm.a6000.4
vm.a6000.8
They should only be used with default images on WEkEO Elasticity WAW3-1 cloud which contain the phrase NVIDIA in their name. These images contain software specifically designed for those flavors.
Key Pair
Many images will apply the public SSH key provided during VM creation. In case of some images, it is the only way of accessing a virtual machine. In the OpenStack CLI client you can list key pairs available to you using this command:
openstack keypair list
While creating your virtual machine using the openstack server create command, you will pass the ID or name of the key pair you chose using the --key-name parameter.
Networks
To list networks which can be connected to your virtual machine, execute the following command:
openstack network list
While creating your virtual machine using the openstack image create command, you will pass the ID or name of the networks you chose using the --network parameter.
Please note that you need to add each network using a separate --network parameter. For instance, if you want to connect your virtual machine to networks called, say, network1 and network2, you can do it by adding the following to openstack server create command:
--network network1 --network network2
Note
If you want to access the EODATA repository on your virtual machine, you should add a network which has a name starting with eodata_ which was added by default to your project.
Security groups
Security groups block or allow different types of Internet traffic on your virtual machine. To list security groups available to you, execute the following command:
openstack security group list
You will pass the security groups using the --security-group parameter. If you want to add multiple security groups, you can do it in a similar way as in the case of networks (mentioned above). For instance, if we want to add the security groups called group1 and group2, you will need to add the following to openstack server create command:
--security-group group1 --security-group group2
Step 2: Create a virtual machine
Execute the openstack server create command. Add parameters based on choices you made in Step 1. Finish the command with the name of your choice for your virtual machine.
Example
Let’s assume that we uploaded the Debian 11 image as explained in How to upload your custom image using OpenStack CLI on WEkEO Elasticity - under the name Debian-test. We do not have another image under the same name and we want to create a virtual machine with the following specifications:
Name: Test-Debian
Flavor: eo1.small
Source: the Debian-test image we just uploaded
Key Pair: ssh-key previously uploaded to your account
Security groups: default and allow_ping_ssh_icmp_rdp
Networks: cloud_00734_1, eodata_00734_1
In your case, these parameters might be different.
Please note that in case of this image the key pair is required - the resulting virtual machine can only be accessed using SSH. The default account does not allow login via password.
In the case explained above, the command for creating this virtual machine would be as follows:
openstack server create --image Debian-custom-upload --flavor eo1.small --key-name ssh-key --network cloud_00734_1 --network eodata_00734_1 --security-group default --security-group allow_ping_ssh_icmp_rdp Test-Debian
If you entered the command correctly, you should see the output containing the information about your VM, for example:
The OS-EXT-STS:vm_state will probably show building which means that the VM is being deployed. To check the current status of your VM, copy the ID of your VM from the field ID. After that, execute the command below. Replace 5be763f5-26aa-447b-b944-7c1d8775c9a9 with the ID of your VM.
openstack server show 5be763f5-26aa-447b-b944-7c1d8775c9a9
Typically after up to a minute the command above should show the output with Running in the field power_state:
This means that your virtual machine should be operational. As stated previously, however, virtual machines created with this image can only be accessed via SSH. Since the SSH key was provided during VM creation, it should be possible.
Step 3 How to add floating IP with CLI
To access the virtual machine from the Internet, the virtual machine needs a floating IP. You can check the list of Floating IPs available in your project by executing this command:
openstack floating ip list
If the output is empty, it means that the project does not have any yet.
To assign a floating IP to your project, execute the following command. In it, external is the name of the external network used in your project.
openstack floating ip create external
Note
The name of this network is by default external - you can find it using the command openstack network list.
The output of this command should give information about created floating IP, for example:
You should now assign the newly created floating IP to your virtual machine. To do that, execute the following command. In it, replace 64.225.134.148 with the IP address you could find in the output of the previous command, in the field floating_ip_address.
openstack add floating ip Test-Debian 64.225.134.148
If this command is executed successfully, it should not give any output. You can check the assignment by executing the following command:
openstack server list
The row with information about your virtual machine should contain both the local IP address (in this example, it is 10.0.0.119, as well as the floating IP address (here it is 64.225.135.230). If you attached other networks, it should contain local IP addresses for them as well – in this example, it would be 10.240.137.198 for eodata_00743_1 network.
You can now connect to your new VM via SSH to execute commands. In the case of the default Debian image, the username you should use is debian. Therefore, to connect to that VM you should execute the command below. In it, replace 64.225.134.148 with the floating IP address of your virtual machine. Of course, if you need to specify the location of the key used for SSH connection, do it using the -i parameter as usual.
As usual, you should receive a question similar to this:
Answer with yes and press Enter.
You should now be able to execute the commands (the debian account has sudo permissions):
What To Do Next
If you want to access the EODATA repository on your newly created virtual machine on WEkEO Elasticity cloud and it is running Debian, Ubuntu or CentOS, the following article should help: How to mount eodata using s3fs in Linux on WEkEO Elasticity
If, however, your virtual machine on WEkEO Elasticity cloud is running on Windows, you can learn how to access the EODATA repository there using this article instead: How to mount EODATA on Windows virtual machine on WEkEO Elasticity hosting