Getting Started with the OpenStack API through Console Clients

Before getting started with OpenStack Console Clients, you must create a user and add them to the project in the Control panel or using selvpc CLI. After that, you need to install the required software on the local system.

Running RC File

Before installing the software, you need to configure access to the project from the local system and set the environment variables. To do this, from the Control panel:

  1. Go to the Access section in the project, select the default user and pool, and download the RC file.

    Please note that you can only manage resources in one pool using this file. To work with other pools, you can pass the desired name with the --os-region-name key or change the contents with the OS_REGION_NAME environment variable.

  2. From your local computer, change to the directory containing the rc.sh file.

  3. Run a script from this directory with the following command in the terminal where the utilities will be run:

source rc.sh
  1. Enter the requested OpenStack password — the project user password.

Installing the Software

Use the following commands to install the software to work with OpenStack Console clients on your local system.

Please note that each distribution has its own set of utilities.

Debian 9 / 10 or Ubuntu 16 / 18 / 20 (for python3)

apt update
apt -y install build-essential curl git \
    libffi-dev libssl-dev libxml2-dev libxslt1-dev \
    python3-pip python3-dev python3-openssl python3-pyasn1
pip3 install -UI pbr setuptools pytz
pip3 install -UI git+https://github.com/openstack/python-openstackclient.git@stable/wallaby

CentOS

yum -y install epel-release
yum -y install gcc git libffi-devel libxslt-devel openssl-devel \
    python-pip python-devel
pip install -UI pbr setuptools pytz
pip install -UI git+https://github.com/openstack/python-openstackclient.git@stable/wallaby

Fedora

yum -y install gcc git libffi-devel libxslt-devel openssl-devel \
    python-pip python-devel
pip install -UI pbr setuptools pytz
pip install -UI git+https://github.com/openstack/python-openstackclient.git@stable/wallaby

Running a Docker Container with Utilities

You can use a Docker container to install the required software.

  1. Install Docker on your local system.
  2. Create a Dockerfile with the following content:
FROM alpine:3.14

RUN apk add --update --no-cache python3 python3-dev libffi libffi-dev && \
    apk add git openssl openssl-dev cargo build-base iputils bash curl linux-headers && \
    apk add py3-pip py3-cffi py3-tz py3-pbr py3-setuptools && \
    pip3 install -UI git+https://github.com/openstack/python-openstackclient.git@stable/wallaby \
                    git+https://github.com/openstack/python-heatclient.git@stable/wallaby \
                    git+https://github.com/openstack/python-octaviaclient.git@stable/wallaby \
    && apk del build-base linux-headers python3-dev libffi-dev openssl-dev && rm -rf /var/cache

CMD ["sh"]
  1. To build a container run the following command:
docker build -t osc:wallaby .
  1. Run Docker from the directory containing the rc.sh file:
docker run -ti --rm -v $(PWD):/workspace osc:wallaby
  1. Before that, run the rc.sh script from the /workspace folder inside docker container:
cd workspace/ && source rc.sh

After that, you can use the utilities presented above in the container.

SSH Key

You can use an SSH key to connect to virtual machines via SSH.

Creating an SSH Key

To create an SSH key, run:

openstack keypair create <key> --private-key <file>
chmod 600 <file>

This command will output a private key to the file. This key will help to connect to virtual machines via SSH. The connection command in this case will look as follows:

ssh -i <file> <server IP>

Please note that if you do not specify --private-key <file>, then the content will be displayed on the screen.

If you already have a «private key – public key» pair, you can specify the public key as an argument:

openstack keypair create <key> --pub-key <path to public key>

For example:

openstack keypair create my_key --pub-key ~/.ssh/id_rsa.pub

Adding an SSH Key

You can also add SSH keys in the Access section of the project in the Control panel.