Previously we published various guides on Rackspace Cloud Files to use CDN and Cloud Object Storage for hosting static website to hosting jQuery powered video players. Lately, Rackspace Cloud Files has been very costly with a fixed per month fees for just having the account. We have similar guides on HP Cloud CDN (HP Public Cloud has been closed). Other CDNs like KeyCDN not exactly cost effective and has marketing tricks. We noticed that IBM Cloud CDN uses Akamai. This website uses CacheFly CDN and it is too costly for ordinary usage. Performance of CacheFly CDN for reverse proxy, without doubt, is among the best. But again, it is very costly for day to day testing works where upload is the need.
New users must identify that IBM Cloud CDN and Cloud Object Storage are two separate services. It is practical to have an IBM Cloud account verified with a credit card. We have not tested with a free account. Only using IBM Cloud Object Storage will help to upload the content and make it publicly accessible. That will be great for only the US users (most of the internet users are from the US). Adding IBM Cloud’s CDN service will make that thing globally distributed – it is a good optional addition for global users. We are describing two systems as separate two paragraphs.
How To Use IBM Cloud Cloud Object Storage
We will suggest using Amazon S3 command line tool (s3cmd is a quite popular tool) for the command line users. It is very easy to configure with IBM Cloud. IBM has their own tools, as well as OpenStack tools can be used. However, they are not just easy – configuring security demands a good grasp of using different IaaS services. CyberDuck is a good GUI tool for any kind of object storage and CDN.
As for Amazon S3 command line tool, as a prerequisite :
- Microsoft Windows 10 needs configuring Ubuntu Bash
- Any GNU/Linux needs nothing more to do
- MacOS X needs nothing more to do, yet we commonly use iTerm2 with Homebrew
We need to have Python PIP installed (steps not shown in this guide). Just run this command to install S3CMD :
# pip install s3cmd #
In the meantime, go to IBM Cloud’s dashboard, and then to Cloud Object Storage. Create a “service credential”. You’ll find the official guide here :
It is just clicking an option on left-hand side pane of Cloud Object Storage management window.
Add Inline Configuration Parameters as :
The above parameter makes Cloud Object Storage compatible with the S3 authorization methods. Look at the JSON output in that webpage. You’ll need access key and secret key from that output. Rest we are supplying you here.
After it get installed, run :
# s3cmd --configure #
You’ll be asked the below questions :
Access Key: Secret Key: Default Region [US]: S3 Endpoint [s3.amazonaws.com]: DNS-style bucket+hostname:port template for accessing a bucket [%(bucket)s.s3.amazonaws.com]: Encryption password: Path to GPG program [/usr/bin/gpg]: Use HTTPS protocol [Yes]: HTTP Proxy server name:
You’ll input like this :
Secret Key: Default Region [US]: S3 Endpoint [s3.amazonaws.com]: s3-api.us-geo.objectstorage.softlayer.net DNS-style bucket+hostname... : %(bucket)s.s3-api.us-geo.objectstorage.softlayer.net Encryption password: Path to GPG program [/usr/bin/gpg]: /usr/bin/gpg Use HTTPS protocol [Yes]: Yes HTTP Proxy server name:
Your configuration will be saved in the file `~/.s3cfg`. You can run `cat` on that file or open with text editor like `nano`. The important part of the configuration file as this summary :
[default] access_key =
access_token = ... bucket_location = US ... expiry_date = expiry_days = ... gpg_command = /usr/bin/gpg ... host_base = s3-api.us-geo.objectstorage.softlayer.net host_bucket = %(bucket)s.s3.amazonaws.com ... secret_key = send_chunk = 65536 ... website_endpoint = http://%(bucket)s.s3-website-%(location)s.amazonaws.com/ website_error = website_index = index.html
You can run command of this format to upload `example.txt` from same directory you are to upload it in the bucket named `some-bucket` :
s3cmd --acl-public put example.txt s3://some-bucket/example.txt
You’ll receive response like :
upload: 'bashrc.old.txt' -> 's3://some-bucket/example.txt' [1 of 1] 3106 of 3106 100% in 3s 1007.41 B/s done Public URL of the object is: http://some-bucket.s3-api.us-geo.objectstorage.softlayer.net/example.txt
Open that URL on browser to view the content :
# http://some-bucket.s3-api.us-geo.objectstorage.softlayer.net/example.txt #
That is it. If you want to install CyberDuck as a visual tool to upload then first download the application and install it. There is a guide here :
# https://console.bluemix.net/docs/services/cloud-object-storage/gui/cyberduck.html#transfer-files-using-cyberduck #
How To Use IBM Cloud CDN
It is funny to use IBM Cloud CDN. It is simply reverse proxy to Cloud Object Storage. Create a CDN instance with a domain name like `bluemix.net` or `ibm.com` (it does not matter as long you are not going to use your own domain).
Your main work is at Object Storage settings (not server), use S3 object store option, endpoint will be `s3-api.us-geo.objectstorage.softlayer.net`, bucket name is name of bucket in Cloud Object Storage (otherwise it will fail to find where is the file), change SSL certificate from DV SAN (default) to “default”. You’ll get some new URL for the CDN, like `bucket.cdnedge.bluemix.net`. Whenever any file or directory will be uploaded on Object Storage as publicly available, it will be available via CDN.