OpenStack Object Storage with Swift

OpenStack Object Storage with Swift

Swift is the part of OpenStack responsible for the object storage. Swift is designed to store files, videos, web content, backups, images, virtual machine snapshots and other unstructured data at large scale with high availability. It allows you to save files that can be accessed from everywhere (a bit like dropbox) directly from the web via a browser or API. Data is stored in OpenStack calls “containers” and is managed within Horizon in the Object Store > Containers section.

For more information about Swift, you can refer to the official OpenStack documentation: https://wiki.openstack.org/wiki/Swift

Note:

Before you can start using Swift, you will need to install the OpenStack Command Line Interface tools.

 


Here are a few basic commands for Swift’s usage:

  • List all possible options for swift with swift help
$ swift help
  • List your containers and show their statistics with swift stat
$ swift stat
                        Account: AUTH_ecc8b566306f4c3bb384fa218edca862
                     Containers: 1
                        Objects: 0
                          Bytes: 0
Containers in policy "policy-0": 1
   Objects in policy "policy-0": 0
     Bytes in policy "policy-0": 0
    X-Account-Project-Domain-Id: default
                    X-Timestamp: 1472750932.80332
                     X-Trans-Id: tx08a5eb4a16924f2c87450-0057c86563
                   Content-Type: text/plain; charset=utf-8
                  Accept-Ranges: bytes
  • Create a new container with swift post
$ swift post container1
  • Upload a file inside a container with swift upload
$ swift upload container1 test.txt
test.txt
  • List the content of a container using swift list container_name
$ swift list container1
test.txt
  • Download a file from a container to your workstation with swift download
$ swift download container1 test.txt
test.txt [auth 0.556s, headers 3.405s, total 3.408s, 0.001 MB/s]
  • Delete a container and/or its content with swift delete
$ swift delete container1
test.txt
container1