How do I access object storage by the command line?

Overview

SoftLayer object storage provides a low cost storage solution that can be used for many applications. Unlike file and block storage, object storage manages data as objects, with each object including the data itself, some metadata, and a globally unique identifier. For more information about the right storage solution for your application, please read Which storage solution is best for your project?. The command line is a powerful and flexible method to access object storage. There are several tools that can be installed and used from a Linux terminal. A common package is python-swiftclient used with the latest version of Ubuntu (14.04) for this example. Steps may vary depending on your distribution.

Advantages: Large files (> 5 GB) are supported, File segmentation is supported.
Disadvantages: No advanced features (encryption, compression, etc.), No graphical interface
Use Cases: Access when no graphical interface is available, uploading and downloading large files

 

Access by Command Line (Linux)

  1. Access the Object Storage Screen
  2. Click the View Credentials link (record your credentials).
  3. Access the server's command line.
  4. Install the python swift client (this command is for Ubuntu, your distribution's commands may vary):
    apt-get install python-swiftclient
  5. Export the authentication credentials to simplify later steps:
     
    export ST_AUTH=     (https://tor01.objectstorage.softlayer.net/auth/v1.0/ )
    export ST_USER=     (IBMOS278685-10:######)
    export ST_KEY=      (#############)
    
    
  6. Upload any files or directories you wish to the container you created earlier:
    swift upload
    Example: swift upload StorageContainer testfile.txt
  7. Swift object storage has a 5 GB single file upload limit. If you have files larger than this, you can upload them in segments with the following command:
    swift upload -s
    Example:swift upload -s 1073741824 StorageContainer largefile
    Note: This command will break large files into 1 GB chunks.
  8. Downloading a file follows the same format swift download
    Example:swift download StorageContainer testfile.txt