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
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.
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.
Set Error Pages (Optional)
$ swift post -m 'web-error:error.html' website
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