Access a project via CLI

Each OpenStack project has a related client project that includes Python API bindings and a CLI.

Prerequisites

  • A project
  • A user 
  • Python 2.7 or later installed

Overview

Requirements

To install all clients you will first need to install pip as follow:

MacOS
# easy_install pip
Ubuntu
# apt install python-dev python-pip
Windows
# easy_install pip
Red Hat Enterprice Linux / CentOS / Fedora
# yum install python-devel python-pip

Main clients

Openstack

Any Operating System with pip installed
# pip install python-openstackclient

Magnum

Any Operating System with pip installed
# pip install python-magnumclient

Octavia

Any Operating System with pip installed
# pip install python-octaviaclient

Extras

The link below is a collection of all other clients:

https://wiki.openstack.org/wiki/OpenStackClients

Create an API user

To access a project via CLI, you will need an API user which is not the CityCloud user you used to log into the Control Panel.

  1. Log into the Control Panel
  2. Click on Create ... + in the top right corner and then select "Openstack User"
  3. Fill in the form and select "_member_" and "swiftoperator" as roles for the project you want to create the Openstack User for

Download the user RC-file

To be able to connect to your project via the Openstack CLI, you need to download the RC-file for your project user:

  1. Log into the Control Panel
  2. Go to Users → Openstack Users and click on the meatballs menu () right next to the user you would like to use to connect to your project.
  3. Select "Generate RC file"
  4. In the pop-up window, select the project you want to download the RC-file for
  5. Press Download

A RC-file will then be generated and downloaded to your default download directory with the following naming convention: 

<USER>--<REGION>--<PROJECT>--rc

and content:

OS_REGION_NAME=***
OS_USER_DOMAIN_NAME=***
OS_PROJECT_NAME=***
OS_AUTH_VERSION=***
OS_IDENTITY_API_VERSION=***
OS_PASSWORD=***
OS_AUTH_URL=***
OS_USERNAME=***
OS_TENANT_NAME=***
OS_PROJECT_DOMAIN_NAME=***

The file contains full access credentials to a project! Store it in a safe place.

Source the file

Go to the directory where you store the RC file and run:

$ source <USER>--<REGION>--<PROJECT>--rc

You are now ready to access your project via the command-line.

Test connectivity

Test you can successfully connect to the project by running:

$ openstack project list
+---------------------------+-------------+
| ID                        |     Name    |
+-----------------------------------------+
| ae048391b2654f....		|  MyProject  |
+---------------------------+-------------+