Setting up an Object Storage Bucket SDK on your ECS Instance

Photos via Pexels


Object Storage Service (OBS) provides a massive, secure and reliable data storage capabilities. Users can use OBS Console or OBS Browser to access and manage data stored in OBS from any computer connected to the Internet anytime and anywhere.

An OBS SDK is the encapsulation of RESTful APIs provided by OBS to simplify users interactions with their OBS objects.

In my previous article, i have covered the topic of mounting your Object Storage Bucket as a File System on your ECS Instance, which is for me the best solution to perform daily exchanges such as moving your local files and directories directly to the mounted Bucket without having to use the Cloud Provider’s Object Storage Console. However, the other alternative is to use the Object Storage Service (OBS) SDK to communicate with your S3 Bucket.

For this tutorial, i’ll be using the Flexible Engine Cloud Provider.So, i’ll focus on setting up the Flexible Engine Python SDK to access my Object Storage Bucket. However, the process is same if you’re using another Cloud Provider, you just need to get the appropriate SDK development package.


In order to get started, all what you need is a Flexible Engine account (or any Cloud Provider account that provides an Object Storage SDK development package), a Linux compute instance and of course an SSH access.

You also need to connect to your Cloud Provider account and setup up an IAM policy for your Object Storage Bucket :

For more information about how to perform these steps , check out the Flexible Engine Documentation or your Cloud Provider Documentation.

Step 1: Install OBS SDK

  1. Download the OBS Python SDK development package by referring to Downloading the SDK.
  2. Decompress the development package to obtain folder src(SDK source code), folder examples (sample code), file README.txt(feature description file of SDK versions), and file log.conf(SDK log configuration file).
  3. Download and install setuptools.
  4. On the command-line interface (CLI), go to folder src under the directory where the development package is decompressed.
  5. Run the python intallcommand to install the SDK.
  6. After the installation, check whether a folder named esdk_obs_python<versionId>-*.eggis generated in lib/site-package under the Python installation directory.

Step 2: Configure Credentials and EndPoints

For Flexible Engine, you can find your bucketname and endpoint on the basic information provided in Object Storage Service console on your Flexible Engine account.

Once you’ve set the above parameters, you can construct your obsClient object that will allow you to perform different operations on your OBS bucket.

Now, you can use the examples provided in the examples folder in your SDK package to discover and test the different available methods. In order to get you started, you can test the following code that will allow you to create a bucket, get its location and storage informations and then delete it.

In order to move forward with your OBS SDK learning process, you can refer to the articles cited in the reference section.

References :

Object Storage Service SDK

Flexible Engine Object Storage Service

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store