How to install & configure Swift command-line client (python-swiftclient)

In some circumstance there may be a need to complete a repetitive sequence of tasks. This does not work well with a dedicated interactive GUI client. You may want to use one of the command line clients described here. This can be useful is places such as timed (CRON) or triggered scripting where a regular set of commands can replace an otherwise manual operation.

Install the Python-Swift command line client for your OS

Launch or run the utility that gives the command prompt for your system.

Mac OS X ( Application | Utilities | Terminal )

sudo easy_install pip
sudo pip install python-swiftclient
sudo pip install python-keystoneclient

Ubuntu and Debian ( Terminal )

sudo apt-get install python-pip
sudo apt-get install python-swiftclient

RHEL, CentOS and Fedora ( Terminal )

sudo yum install python-setuptools
sudo easy_install pip
sudo pip install python-swiftclient

Windows ( Start |  cmd )

Install pip for Windows first

pip-Win is a tiny Python Package manager for Windows. Download pip-Win from the link  on this page.

At the command line you should then be able to install the Python Swift client

pip install python-swiftclient

Download your OpenStack RC file and modify it with your keystone password

Go to the NeCTAR Research Cloud Dashboard

After logging in, click on Access & Security under the Compute on the left Project menu bar and then click on API Access tab, and then click on Download OpenStack RC File to save it on your local computer

Open the RC File you downloaded (e.g. with any text editor and remove the following content at the bottom

# With Keystone you pass the keystone password.
echo “Please enter your OpenStack Password: ”

Next, add the following text, replacing <> with your actual keystone password) and save the file

# With Keystone you pass the keystone password.
export OS_PASSWORD=”<>”
# With VicNode as the default region.
export OS_REGION_NAME=”VicNode”

The Swift command-line client should now be configured. To test it:

Open a Terminal window
Executes the content of your modified OpenStack RC file and passed as argument in the current shell:
$ source
Displays information for account, container or object in your VicNode Vault storage:
$ swift stat
and you should see something similar to the following
Account: AUTH_352
Containers: 2
Objects: 1010
Bytes: 17521271812
Meta Quota-Bytes: 1000000000000
Set-Cookie: BIGipServer~VICNODE_RDSI~z1_rd0_pl_rdsi_http8888=407444140.47138.0000; path=/
X-Timestamp: 1405567423.53533
X-Trans-Id: tx28ade97b517846f1888a1-0053c8cbcc
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes
Lists the containers for the account or the objects for a container in your VicNode Vault storage:
$ swift list
and you should see something similar to the following

  • The NeCTAR python-swift webpage is a good introduction to python-swift commands
  • A list of available swift commands can be found here.