This help article will illustrate how to work with the Kili Cloud object storage service (swift) from the CLI.
- A kili account
- Basic knowledge of unix terminal
We recommend installing the swift client (and all other python packages) via pip. You can also install the swift client from your distro's software repositories but chances are that it will be out of date.
pip install python-swiftclient
We use Keystone - The official OpenStack Identity Service - for authentication. For swift client to authenticate to your account, you have to install the keystone client.
pip install python-keystoneclient
To facilitate authentication, we provide you with an rc script that the swift
client will use to access your account.
to save it (login if prompted).
Once saved, run
source XXX-openrc.sh and enter your kili password when prompted.
Test if it works by running
swift stat which will print your account summary, that looks like what we have below.
Account: AUTH_XXXXXXXXXXXXXXXXXXXXXXXX Containers: 0 Objects: 0 Bytes: 0 Accept-Ranges: bytes Server: nginx/1.4.7 Connection: keep-alive X-Timestamp: 123456789123.123456 X-Trans-Id: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ContenType: text/plain; charset=utf-8
Swift client provides 6 sub-commands that you you use to manage your data. From the official swift client documentation, they are:-
stat- Displays information for the account, container, or object.
list- Lists the containers for the account or the objects for a container.
post- Updates meta information for the account, container, or object.
upload- Uploads files or directories to the given container.
download- Download objects from containers.
delete- Delete a container or objects within a container.
You can also run
swift help for more.
Working with containers
Containers are name spaces used to group objects in an account. You can choose to create them as private, for 'internal' use, or as public, to share content over network or the INTERNET.
swift post CONTAINER_NAME creates a container with the name
swift list prints out a list of your containers.
swift stat CONTAINER_NAME prints out a summary of an existing container called
swift delete CONTAINER_NAME deletes an existing container called
Working with objects
Objects are the actual data stored in swift. You can think of them as files on a conventional file system. These could be your documents, photos, videos, music, disk image snapshots, log files.....the list goes on.
swift upload CONTAINER_NAME foo.jpg uploads a file
foo.jpg to an existing container.
For larger files such as disk images, you may want to upload in chunks by passing an
swift stat CONTAINER_NAME foo.jpg prints out info on a previously uploaded object
foo.jpg inside an existing container.
swift list CONTAINER_NAME prints a list of objects in the named container.