Install openstack-python client and authenticate with an API user


OpenStackClient is a command-line client for OpenStackOpenStackClient (aka OSC) is a command-line client for OpenStack that brings the command set for Compute, Identity, Image, Object Storage and Block Storage APIs together in a single shell with a uniform command structure.

Step-by-step guide


First of all make sure you have python 2.7 or later installed. 


  1. Install pip on the machine using the command matching your operating system.

    MacOS
    # easy_install pip
    Microsoft
    # easy_install pip
    Ubuntu or Debian
    # apt install python-dev python-pip
    Red Hat Enterprice Linux, CentOS or Fedora
    # yum install python-devel python-pip
  2. After pip is installed you can install the python-openstack client by running the following command.

    # pip install python-openstackclient

    If you don`t want to install it via pip it is possible to install it from packages. RDO, Debian, and Ubuntu have client packages that can be installed without pip. 

    Red Hat Enterprice Linux, CentOS or Fedora
    # yum install python-openstackclient
    Ubuntu or Debian
    # apt-get install python-openstackclient
  3. When you have a client installed you need to create an API user. To do this login to https://citycontrolpanel.com and click on API and then on "Native Openstack API"




  4. Here you will se current users and you can see all endpoints where to connect for different clients. Focus on the openstack client and wont bother with anything else for now. 

  5. To create a new user click on the "+Add new user" button. Fill in the username and password for your user and drag the project you want that user to have access to into the correct box. Several projects can be chosen. Then Click on "Save".




  6. To be able to use the openstack client you have to authenticate with our new API user. To do this you first have to download an RC file. To do this click on the gear icon next to your API user and then on "Download RC-File"




  7. Download the file. Then yiu have to change the password in this file before doing anything else.
  8. When this is done we have to make sure our client program can find the OS_ variables. To do this we need to source the file. Simply run "source openstack.rc" in a terminal and after that you are good to go. Try running an openstack command.




  9. Installation is now done and you can start to use the different openstack commands. 

You can find some examples of Openstack commands to use here: https://docs.openstack.org/ocata/user-guide/cli-cheat-sheet.html