How to use the OpenStack CLI tools on Mac OS X
Estimated time to read: 4 minutes
This tutorial describes how to use the OpenStack Command Line Interface (CLI) tools on Mac OS X. For example, you will learn how to list your instances and volumes by using the CLI. You will also learn how you can launch a new instance by using the CLI.
For this tutorial you’ll need the following:
- A Fuga Cloud account
- A device running Mac OS X
In case you’re running Windows or Linux, please check out the following guides:
Step 1 - Installing Python 3
If you want to use the Dockerfile (explained in step 3), you can omit this step.
The OpenStack command line tools need Python and Python on OS X is utterly broken, but fortunately, you can install your own, up-to-date version.
To install homebrew use the following command lines:
Install a stable Python binary from Python.org downloads
Installing the OpenStack command line tools
Now Python3 is installed you can install the OpenStack command line tools:
Step 2 - Install the configuration file
Now, follow the steps below to install the configuration files:
- Log in to the Fuga Cloud Dashboard
- Then go to the Access tab
- Here you can create OpenStack API Credentials (Remember to save the password in a safe place)
- Now you can choose to download one of three files (Dockerfile, OpenRC, Clouds.yaml). These files contain all necessary configurations for the clients.
save this file to the folder where your project resides
Build the Docker container
Run the interactive CLI
Save this file to the folder where your project resides. <$CLOUD_NAME> is the name of the cloud specified on line 2 in the clouds.yaml file. By default this is fuga.
List your instances
Step 3 - Using the Fuga CLI
You have now installed and configured the OpenStack CLI client and 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.
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, you don’t have to use the OpenStack command on every single command line. For example:
If you want to exit the environment, use
Step 4 - Creating a new server with CLI
First, you need to create a new key. You can name it, for example, test_cli_key or use an existing key.
Creating a key with the CLI can be done the following command:
Now test if the key is created:
Step 5 - Exiting the environment
Deactivating the virtualenv
When you’re done with the virtualenv, run deactivate. You’ll see your prompt revert to normal.
Reactivating the virtualenv
Anytime you want to run your virtual environment, activate the “fugaio” virtualenv as shown in step 3. This will put you into the appropriate virtualenv with all the necessary modules and dependencies. When you’re done, simply deactivate it again.
Using the clouds.yaml file
Unless you’re in a virtualenv, you don’t have to do anything.
Using the Dockerfile
Press Ctrl-D or type exit in the active terminal to exit Interactive mode.
In this tutorial, you’ve learned how to use the OpenStack Command Line Interface tool on Mac OS X. You leared how to list your instance and volumes using this tool. Besides this, you also learned how to launch a new instance by using the CLI.
More tutorials about using the Command Line Interface can be found here.