1. Home
  2. Cloud
  3. How do I use OpenStackClient to manage Oderland Cloud?

How do I use OpenStackClient to manage Oderland Cloud?

This guide is intended for advanced users.

Oderland Cloud is based on OpenStack and in addition to our control panel, you can also manage and administer your environment efficiently with the OpenStackClient. The client allows for management through the terminal or command prompt, providing easy access to a wide range of features for both daily use and automation of various processes.

This is a general guide showing how to connect to your OpenStack environment through the OpenStackClient. It also covers the use of YAML files for configuration, providing a convenient and flexible method of authentication. With these steps, you can quickly start interacting with your OpenStack environment and manage your cloud resources smoothly.

Preparations

Now let’s explore the steps required to configure and use OpenStackClient to connect to your OpenStack environment.

  1. Install OpenStackClient:
    First, you need to install the client on your local computer. Depending on your operating system, the installation process may vary slightly. For example, you can use pip (package manager for Python) to install OpenStackClient by running the following command in the terminal:
pip install python-openstackclient
  1. Create a configuration file:
    Create a YAML file (name it clouds.yaml) that contains your credentials and other necessary settings to connect to your OpenStack environment. You can place the file in your current folder right now, but check the official documentation for more information on where the file can be saved for different operating systems. Here is an example of what the file might look like (replace project-name, user-name and password with your details):
clouds:
  oderland:
    auth:
      auth_url: https://cloud-api.oderland.com:5000
      project_name: project-name
      username: user-name
      password: password
      user_domain_name: cloud
      project_domain_name: cloud

You can find your project-name inside the Oderland Cloud control panel, in the top right corner when you are logged in.

  1. Test connection with openstack:
    Now use the --os-cloud-flag to specify which profile to use with your openstack commands. For example, you can use the following CLI command (remember to replace oderland if you called the profile for something else in step 2):
openstack --os-cloud oderland server list

Exploring commands

Now that you have successfully connected to your environment, you can start using openstack to interact with different services. Explore the openstack documentation to learn about the different commands and how you can use them. Examples of some useful commands:

  • openstack --os-cloud oderland server list: Lists all virtual machines in your project.
  • openstack --os-cloud oderland image list: Lists all the available images (operating systems that you can use for new virtual machines) in your environment.
  • openstack --os-cloud oderland flavor list: Lists all flavours that can be used to create virtual machines.
  • openstack --os-cloud oderland network list: Lists all networks in your environment.
  • openstack --os-cloud oderland keypair create --public-key /sökväg/till/publik_nyckel nyckel-namn: Create a public key in Oderland Cloud that can be used when setting up servers. Enter the correct path and file name for the public key instead of /path/to/public_key and enter the name you want the key to have in the control panel (instead of key name).

Here is also an example of how to create a new virtual machine directly through the CLI (terminal/command prompt):

openstack --os-cloud oderland server create \
    --wait \
    --format json \
    --flavor 'a1-c1-m1' \
    --image 'Debian 12' \
    --boot-from-volume 10 \
    --network 'public_1' \
    --key-name 'ssh-key-name' \
    example-server

In the above example, a virtual machine called “example-server” will be created, with Debian 12 and a 10 GB volume. The server will be allocated on our network with the name `public_1`. You need to replace ssh-key-name with the name of your uploaded SSH key.

There is much more information in the official documentation, see for example https://docs.openstack.org/python-openstackclient/latest/.

It is also possible to use enviornment variables to specify credentials. More information on this can be found in the openstack manual..

Was this article helpful?

Related Articles