Getting Started with the OpenStack Flex CLI

How to get started using the OpenStack CLI with your Flex Project

The following guide will get you started in using the OpenStack CLI with your Rackspace OpenStack Flex project.

OpenStack Flex CLI Setup Guide

Prerequisites

  • Rackspace OpenStack Flex account
  • macOS or Linux (or WSL2 on Windows)
  • Python 3 installed (python3 --version)
  • pip package manager (pip3 --version)
  • venv module (usually included with Python 3)
  • Internet access to install Python packages
  • openrc.sh file from your OpenStack Flex Project

1. Create a Directory for Virtual Environments

mkdir virtual_environments
cd virtual_environments/

2. Create the Python Virtual Environment

python3 -m venv flextest

3. Enter the Virtual Environment Directory

cd flextest/

4. Activate the Virtual Environment

source bin/activate

You should see the environment name (e.g., (flextest)) in your shell prompt.

5. Install Required Python Packages

pip3 install openstacksdk
pip3 install python-openstackclient

6. Source Your OpenStack Credentials File

  1. To obtain your openrc.sh file for your project, you'll need to log into the Skyline UI for your project first.
  2. After logging in, click the user icon in the top right > select 'Get OpenRC File' and it will download the file to your local machine.
  3. Now, place that openrc.shfile in your Python Virtual Environment directory you just created. (eg /virtual_environments/flextest)
  4. Now source the file with the below command:
source openrc.sh

You'll be prompted for your API key, and after entering that you should be finished.

7. Verify the CLI Works

Run a basic command to check your setup:

openstack image list

You should see a list of available images from your Rackspace OpenStack Flex account.