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
- To obtain your
openrc.sh
file for your project, you'll need to log into the Skyline UI for your project first. - After logging in, click the user icon in the top right > select 'Get OpenRC File' and leave the default setting of 'Password Type' and it will download the file to your local machine.
- Now, place that
openrc.sh
file in your Python Virtual Environment directory you just created. (eg /virtual_environments/flextest) - 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.
Helpful CLI Commands
Below you'll find some CLI commands that can help you see what commands are available to you, what the proper syntax is, and what they actually do.
To list all top-level commands:
openstack help
This shows categories like compute
, volume
, network
, etc.
To list all subcommands under a specific group:
openstack <category> --help
openstack server --help # Lists commands for managing servers (instances)
openstack volume --help # Lists volume commands
openstack network --help # Lists networking commands
openstack image --help # Lists image-related commands
To list everything (including extensions/plugins):
openstack complete
This prints every available command and subcommand installed in your current environment.
This can be long but comprehensive — useful if you want to grep for specific functionality.
openstack complete | grep floating
Additional Libraries
If you're using openstackclient
, many of these are installed as dependencies. But for full CLI/API or programmatic access, or for debugging, you may need these explicitly:
Service | Purpose | Python Package | CLI Command Example |
---|---|---|---|
Identity | Authentication (Keystone) | python-keystoneclient | openstack user list |
Compute | Virtual machines (Nova) | python-novaclient | openstack server list |
Networking | Virtual networks (Neutron) | python-neutronclient | openstack network list |
Image | Image service (Glance) | python-glanceclient | openstack image list |
Volume | Block storage (Cinder) | python-cinderclient | openstack volume list |
Object Store | Object storage (Swift) | python-swiftclient | openstack container list |
Orchestration | Heat templates (Heat) | python-heatclient | openstack stack list |
Container | Container orchestration (Magnum) | python-magnumclient | openstack coe cluster list |
Load Balancer | Load balancing (Octavia) | python-octaviaclient | openstack loadbalancer list |
Key Manager | Secrets and certs (Barbican) | python-barbicanclient | openstack secret list |
Updated 15 days ago