First steps, “Hello cloud!”

Once the client is functional, using a cloud instance is done in 4 steps:

  1. provide the cloud an SSH key pair to access the instances;

  2. instantiate a server;

  3. (optional) add a public IP to the instance;

  4. connect to the instance.

Create an SSH key pair

This key will allow to establish the SSH session to instances:

% ssh-keygen -t rsa -f ~/.novacreds/cloudkey
[...]

It is then necessary to provide Openstack the public key to be injected in the VMs for the root account:

% openstack keypair create --public-key $HOME/.novacreds/cloudkey.pub cloudkey

To verify the available key pairs:

% openstack keypair list
+----------+-------------------------------------------------+
|   Name   |                   Fingerprint                   |
+----------+-------------------------------------------------+
| cloudkey | 01:4a:cb:05:ff:6a:67:6e:c6:50:e8:a0:eb:ef:e7:95 |
+----------+-------------------------------------------------+

List the available images

% openstack image list
+--------------------------------------+---------------------------+--------+-------------------------+
| ID                                   | Name                      | Status | Server                  |
+--------------------------------------+---------------------------+--------+-------------------------+
| 1e6104b4-d915-4925-832b-798c3ea3b426 | Rocky-8-GenericCloud-8.5  | ACTIVE |                         |
| b5a7711d-f0eb-4a31-98e6-69ef2ed09b6a | official-centos-7x-x86_64 | ACTIVE |                         |
+--------------------------------------+---------------------------+--------+-------------------------+

List the available flavors

Flavors represent the available types of virtual machines. They determine the virtual machines characteristics:

% openstack flavor list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | extra_specs |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| 1  | m1.tiny   | 512       | 0    | 0         |      | 1     | 1.0         | True      | {}          |
| 2  | m1.small  | 2048      | 10   | 20        |      | 1     | 1.0         | True      | {}          |
| 3  | m1.medium | 4096      | 10   | 40        |      | 2     | 1.0         | True      | {}          |
| 4  | m1.large  | 8192      | 10   | 80        |      | 4     | 1.0         | True      | {}          |
| 5  | m1.xlarge | 16384     | 10   | 160       |      | 8     | 1.0         | True      | {}          |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+

Start an instance

To run the instance:

% openstack server create --key-name cloudkey --image official-centos-7x-x86_64 --flavor m1.tiny mavm
[...]

Note

If the projet has several networks it may be necessary specify a network to use with the parameter –network

The VM status can be checked with:

% openstack server list

It is possible to limit to a particular VM with its name:

% openstack server show mavm
+--------------------------------------+----------+--------+--------------------------------------+
| ID                                   | Name     | Status | Networks                             |
+--------------------------------------+----------+--------+--------------------------------------+
| b87775cc-5dad-4de7-a84e-84e2cdf50c2a | mavm     | ACTIVE | mynet=172.17.15.4                    |
+--------------------------------------+----------+--------+--------------------------------------+

(optional) Add a public IP

Depending on the network type the Openstack project is configured, it may be necessary (or discouraged) to associate a floating IP (NAT) to the VM to have it connected on the network.

To create a floating IP address:

% openstack floating ip create floating
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2017-10-24T09:22:35Z                 |
| description         |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 134.158.246.17                       |
| floating_network_id | 8358e0b1-cc39-490a-a86e-a141094b5c95 |
| id                  | 41ee109f-f702-4095-a208-448cb6126145 |
| name                | 134.158.246.17                       |
| port_id             | None                                 |
| project_id          | 0223bc1968bc4e46932c5d87012aaf14     |
| revision_number     | 1                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| updated_at          | 2017-10-24T09:22:35Z                 |
+---------------------+--------------------------------------+

It’s possible to list floatings IPs already created in the projet with:

% openstack floating ip list
+-----------+---------------------+------------------+-----------+-------------------+
| ID        | Floating IP Address | Fixed IP Address | Port      | Floating Network  |
+-----------+---------------------+------------------+-----------+-------------------+
| 564...b6b | 134.158.246.17      | 172.17.15.4      | c85...690 | 835...c95         | => Used floating IP
| a33...a2a | 134.158.246.18      | None             | None      | 835...c95         | => Available floating IP
+-----------+---------------------+------------------+-----------+-------------------+

The IP address must then be assigned to the machine:

% openstack server add floating ip mavm 134.158.246.17
% openstack server show mavm
+--------------------------+------------+--------+-----------------------+
|            ID            |    Name    | Status |        Networks       |
+--------------------------+------------+--------+-----------------------+
| b3741a0d-e5cd-411c-abe8  | mavm       | ACTIVE | mynet=172.17.15.4,
134.158.246.17 |
+--------------------------+------------+--------+-----------------------+

Say hello

% ssh -i ~/.novacreds/cloudkey root@134.158.246.25 echo "hello world"
hello world

Delete the instance

% openstack server delete mavm