Overview

Skill Level: Any Skill Level

Developers wanting to build an application that utilizes Object Storage to maintain their unstructured data.

Ingredients

IBM Bluemix account

Openstack Swift CLI

 

Step-by-step

  1. Create an Object Storage Instance on Bluemix

    • After loggin in to Bluemix, navigate back to the catalog and select storage on the right side bar
    • Select Object Storage as the service you want to use
    • Create an Object Storage instance , this should redirect you to your newly created instance

  2. Create a Container and Make it Publicly Readable

    First, you will need to create a container to hold the files for a static webstie. This can be done through Bluemix or with the swift post command as shown below. For this tutotial our container will be named website.

    $ swift post website

    After creating the container, it must be made publicly readable in order to access your objects directly.

     $ swift post -r '.r:*' website

    Lastly, determine the URL prefix for this container

     $ swift auth

    Simply append /<name-of-your-container> to the URL given by the auth command to access your new static website.

  3. Set Index File

     $ swift post -m 'web-index:index.html' website

    Set the index file. index.html will now be the default file displayed when the site appears.

  4. Set Error Pages (Optional)

    $ swift post -m 'web-error:error.html' website

  5. Get credentials for the Object Storage instance

    • In you dashboard, select your Object Storage instance
    • Navigate to the Service Credentials section using the tabs on the left side of the screen.
    • You will see a JSON object for credentials, these are the credentials that you will export to your environment to use the Swift CLI

2 comments on"Create a Static Website with IBM Object Storage"

  1. […] publish to Object Storage, the action uses the Openstack Swift command-line tool. In addition, it makes the OpenStack swift container public so that its files can be accessed through the […]

  2. Why the Swift Command-line tool necessary? Why no simply add this functionality to Bluemix Console? Ex: Right Click -> Make Readable.

Join The Discussion