Content Management and Capture

 View Only

IBM Cloud Object Storage for File Management

By Sirisha Sharon Nethala posted Mon March 21, 2022 04:37 AM

IBM Cloud Object Storage is a  storage solution that allows one to store and access unstructured data. It is available on the  cloud and can be used as an on-premises solution.The files that are uploaded into IBM Cloud Object Storage are called objects. An object is uniquely identified by an object key which is nothing but the name of the file and can possess metadata. The objects are containers placed in containers called buckets.  Buckets can be configured independently from one another. Few configurable parameters are location, resiliency, billing rates, encryption, versioning, security, and object lifecycle. 

IBM COS uses S3 API library to support CRUD operations. It is available in popular server side programing languages such as Python, Java, Go and Node.js and also has rest endpoints. One can use the user interface,  SDK API,  RESTful APIs or CLI to perfom operations on COS.

A few of the bucket operations that can be  performed using the APIs  are-
  • Create
  • Delete
  • List all buckets
  • List contents of a bucket

Some of the object operations that can be  performed using the APIs  are-
  • Create/Update object (uploading files along with metadata)
In case the object to be uploaded is large,  Multipart upload is preferable. Here the large file is divided in smaller chunks and uploaded in parts.
  • Update object metadata
  • Delete object(latest or based on the specified version)
  • Delete objects(latest or based on the specified version)
  • Get object (latest or based on the specified version)

For files greater than 1GB , it is recommended to use the Aspera  which supports high speed data transfers and is proven to be beneficial for streaming multimedia.

All the operations listed so far needed users to have IBM cloud credentials. So how would one display files in their applications / web pages to users who do not have the necessary credentials?  Pre-signed URLs are the solution!
Users with valid credentials can generate pre-signed URLs to share with others.  These URLs have an expiration period that is specified at the time of creation.

Here is a quick guide on using  APIs which would help use IBM COS in your application.

Prerequisites for using COS:
  • IBM cloud account - to provision a COS instance
  • IAM API key - to generate  IAM tokens which are used for authorization

1) Provisioning a COS instance from your IBM cloud account

2) Create Service Credentials with HMAC option in case you want to generate pre-signed URLs

3) Create bucket

4) Create an API key in Access IAM portal and make a note of it

Bucket list in COS

List of objects(files) in a bucket

5) Perform object CRUD operations using the UI, SDK, CLI or Rest APIs.

The sample usages of SDK and Rest APIs are illustrated below.

With the API key created in step 4, an IAM token is generated. This token is used along with the details of service credential instance for the following purposes-

  1. To instantiate S3 client object used to execute object and bucket operations

           b. As a part of the headers for invoking the CRUD rest API operations to access and manipulate objects and buckets
    • Generate the access token
    • Use the access token generated to execute the Rest APIs 

Ease of use and rich API support makes IBM COS a convenient option for storage of files in an application.

To find out more check out the following link-