Much of the power of Openstack OpenStack is in the suite of application program interfaces (APIs), allowing the same functionality of the dashboard with the advantage of automating much of the provisioning process with only a few commands. Using the API means that all the actions can be added added to a script that can be called to automatically and repeatedly build instances. You can also create template-like scripts so that with only minor modification to instance name, image and volume size, it is possible to build other instances and volumes quickly and without the need for clicking through the dashboard.
Before the tools are installed, you will want an environment that can use Python, as all of the Openstack OpenStack command-line tools are written in that language. This can be your local desktop or it could be a virtual machine in the Rapid Access Cloud. The instructions outlined below will assume a Ubuntu 14.04 instance in the Rapid Access Cloud, a virtual machine running on your desktop or a native Ubuntu desktop.
Using an rc file to outline your Rapid Access Cloud credentials allows you to pass your credentials to the cloud without needing to include them in your scripts. In fact, the rc file is a simple bash script that creates environment variables in your shell to be used by the
openstack command (the ‘open’ 'open' in openrc). The environment variables, once set, exist only for the current session. If you open another concurrent session on the computer or log-out and back in, you will need to source the openrc file again.
Log-in to the Rapid Access Cloud dashboard at https://cloud.cybera.ca.
In the left-hand panel under “Compute”, click “Access & Security”.
Click the “API Access” tab at the top then click the “Download Openstack RC file” file v3” on the right.
The file downloaded will be named after your account name, e.g. <email>@<domain>-openrc.sh. This can be renamed to openrc if you like, or you can copy it and modify it so you can have one for the Calgary region and one for the Edmonton region. The rc file downloaded will be keyed for the region you are signed into in the dashboard.
Add this line to the downloaded openrc file:
You can use the downloaded rc file as a template or create one from scratch. The OS_USERNAME and OS_TENANTPROJECT_NAME variables are the same; each will be the email address for your Rapid Access Cloud account.
#!/bin/bash export OS_REGION_NAME="Calgary" export OS_VOLUME_API_VERSION=2 export OS_AUTH_URL=https://keystone-yycyeg.cloud.cybera.ca:5000/v2.0v3 export OS_PROJECT_NAME="<account_username>" export OS_USERNAME="<account_username>" export OS_TENANTUSER_DOMAIN_NAME="<account_username>" Default" export OS_REGION_NAME="Calgary" export OS_INTERFACE=public export OS_IDENTITY_API_VERSION=3 echo "Please enter your OpenStack Password for project $OS_PROJECT_NAME as user $OS_USERNAME: " read -sr OS_PASSWORD_INPUT export OS_PASSWORD=$OS_PASSWORD_INPUT
#!/bin/bash export OS_REGION_NAME="Edmonton" export OS_VOLUME_API_VERSION=2 export OS_AUTH_URL=https://keystone-yeg.cloud.cybera.ca:5000/v2.0v3 export OS_PROJECT_NAME="<account_username>" export OS_USERNAME="<account_username>" export OS_TENANTUSER_DOMAIN_NAME="<account_username>" Default" export OS_REGION_NAME="Edmonton" export OS_INTERFACE=public export OS_IDENTITY_API_VERSION=3 echo "Please enter your OpenStack Password for project $OS_PROJECT_NAME as user $OS_USERNAME: " read -sr OS_PASSWORD_INPUT export OS_PASSWORD=$OS_PASSWORD_INPUT
Sourcing the rc File
Whether you downloaded the RC file or created your own, you will need to "source" into your shell environment:
This tutorial will walk through some of the steps outlined in the Basic Guide in building a single instance from scratch, with some notes about alternative functionality that each command offers, to show how flexible using the OpenStack command line client is.