Using the command line tools for OpenStack on Windows is a bit different and a bit more difficult. In this guide we provide you with the steps required to set this up.
Use the latest stable Python web-based installer from https://www.python.org/downloads/windows/ with these extra settings:
- Add to PATH
- Add to environment variables
In our experience the process is easier when using Firefox or Chrome instead of Edge
To test if python is working and correctly added to the PATH variable:
python --version pip --version
Install C++ Compiler
Download and install visual c++ build tools 2015 from this link: http://landinghub.visualstudio.com/visual-cpp-build-tools.
Setting environment variables
To communicate with your OpenStack API, you'll need to configure some variables. The default OpenStack RC file is only built for UNIX-based systems, so it will not work on Windows. This means that we have to set our environment variables manually, also we have to add the C++ compiler to the PATH variable. This can be accomplished by searching for "system" or "edit the system environment variables", or going into your Control Panel, scrolling to the System and Security section, and clicking on System.
From that window, you will see an Advanced tab, wherein you can set your environment variables.
Or in short: System -> advanced -> Environment Variables -> System variables -> PATH -> edit then add the "VC\bin" folder of the visual studio install-path to the system variable PATH
add for example:
C:\Program Files(x86)\Microsoft Visual Studio 14.0.\VC\bin;
To the front of the line.
Now test if this works, go to powershell or commandprompt (restart powershell or commandprompt) and enter:
If the version returns you did it correctly.
Now add some variables for the OpenStack CLI.
Go to System -> advanced -> Environment Variables.
add to variables (tried for v3 of OpenStack):
OS_AUTH_URL: https://identity.api.fuga.io:5000/v3 OS_PASSWORD: *password* OS_REGION: cystack OS_USERNAME: *username* OS_IDENTITY_API_VERSION: 3
If you're unsure what to fill out, you can download the OpenStack RC file from the Horizon dashboard (through Access and Security - API access). Open the RC file in Notepad and you can find these variables (except password) and their values. More advanced users can also add the environment variables directly in PowerShell. To do this, first look at your variables overview.
To add a new one:
set-item env:OS_PASSWORD -value "password"
If you want to delete an environment variable:
Now in powershell or commandprompt:
pip install -U buildtools pip install python-openstackclient
Check if everything works:
openstack server list
If your servers are returned everything is set up.
Use the Fuga CLI
You have now installed and configured the OpenStack CLI client and you can start using the Fuga CLI.
The following are some examples you can try. You can also call
openstack help for all available commands. For more in-depth information check out OpenStack command-line clients.
List your instances
$ openstack server list
List your volumes
$ openstack volume list
List the images
$ openstack image list
If you only enter the command openstack, you enter interactive mode. This mode lets you interact faster with the Fuga CLI.
While in interactive mode enter: help to get all the different commands.
If you only need to find a specific command enter:
$ openstack help | grep "<your command>"
$ openstack help | grep list
This will return all list commands.
Create a new server with the CLI
Start an interactive session with:
First create a new key named for example test_cli_key or use an existing key.
Creating a key with the CLI can be done with the following command:
keypair create test_cli_key
This command returns the newly generated private key. Store this somewhere save.
Now test if the key is created:
Next up is to list the images and flavors we can choose from.
image list flavor list
In this example I chose to create an instance, named CLITest with debian 9 of a small server using the newly generated key.
server create cli_test --image 5a2a94e7-3364-4bf8-a66b-ac84bc2c92de --flavor c1.small --key-name test_cli_key
After a few seconds the server is created and built.