Setting up OpenStack CLI environment

by Brian Banaszynski

You need to prepare your environment by defining some variables that will be used by the CLI tools when interacting with the OpenStack endpoints.

Below is a sample of an environment variable file that we can then source in our current session.

export OS_AUTH_URL=https://cloud.dsm.net/keystone/v3
export OS_IDENTITY_API_VERSION=3
export OS_REGION_NAME="<region_name>"
export OS_USERNAME="<username@domain.com>"
export OS_PASSWORD="<your_password>"
export OS_PROJECT_NAME="<your_tenant_name>"
export OS_PROJECT_DOMAIN_ID=${OS_PROJECT_DOMAIN_ID:-"default"}
export OS_USER_DOMAIN_NAME=default

You can also navigate to the Access & Security > API Access tab in the portal to obtain the environment variables for that specific portal session. Copy and paste those into a file on your computer to later source.



After you’ve created your RC file, in your terminal session, source it:

source sample_openstack_rc.sh

Now activate the virtual OpenStack CLI environment. This example assumes you created the virtual environment in your home directory in “.virtualenvs/os_cli”:

source ~/.virtualenvs/os_cli/bin/activate

You can now execute commands against the OpenStack API endpoints.

Refer to the OpenStack Client documentation for additional information on leveraging the CLI.


How Did We Do?