Tuesday, 8 April 2014

First steps with Oracle Storage Cloud Service

The Oracle Storage Cloud Service is based on OpenStack which is very obvious as the Oracle documentation is linked to OpenStack.

For the first steps I have requested a trial service, which is 30 days-free trial, through https://cloud.oracle.com/storage.





The service is provisioned after some minutes and the stage ist set for the first "Hello, World"

The data is stored in the form of objects, which must reside in a container. Containers could also be stored in other containers. The objects and containers have default metadata and could be extended by custom metadata. For more details on the archtecture and backgrounds see here.

Steps to be performed
  1. Request a token for the communication
  2. Create a container
  3. Create an object
  4. List the objects in a container
  5. Show the content of an object


1. Request a token for the communication

The URL is from standard Oracle Storage Cloud Service URL "https://storage.us2.oraclecloud.com/auth/v1.0" the X-Storage_user is combined from here service-instance-name "storagetrial4937" and the identity-domain-name here "deoraclegermatrial48847". Both is to be found in the information sent during creation of the account.

To access any of the APIs, a token has to be requested as a first step. This token is used/mandatory for subsequent steps:

curl -v -X GET -H 'X-Storage-User: storagetrial4937-deoraclegermatrial48847:steffen.miller@oracle.com' -H 'X-Storage-Pass: MySecret' https://storage.us2.oraclecloud.com/auth/v1.0

This returns beside much more information:

X-Auth-Token: AUTH_tkb7b10c1b7720a8b677d88a63a005ddd9


2. Create a container through the REST API

The URL is combined from standard Oracle Storage Cloud Service URL "https://storage.us2.oraclecloud.com/v1/" the service-instance-name here "
storagetrial4937" and the identity-domain-name here "deoraclegermatrial48847". Both is to be found in the information sent during creation of the account.

The above "X-Auth-Token" token is used to create the container "myContainer":

curl -v -X PUT -H 'X-Auth-Token: AUTH_tkb7b10c1b7720a8b677d88a63a005ddd9' https://storage.us2.oraclecloud.com/v1/storagetrial4937-deoraclegermatrial48847/myContainer

The return reponse contains
HTTP/1.1 201 Created

3. Create an object

Now we are able to store an object "myObject" in the container:

curl -v -X PUT -H 'X-Auth-Token:  AUTH_tkb7b10c1b7720a8b677d88a63a005ddd9' -d 'Hello, World!' https://storage.us2.oraclecloud.com/v1/storagetrial4937-deoraclegermatrial48847/myContainer/myObject

The response contains 

upload completely sent off: 13 out of 13 bytes
< HTTP/1.1 201 Created

After this step we have created an object "myObject" in the container "myContainer" with the contents "Hello, World!"

4. List the objects in a container

To verify that the object is where we suspect it to be:

curl -X GET -H 'X-Auth-Token: AUTH_tkb7b10c1b7720a8b677d88a63a005ddd9' https://storage.us2.oraclecloud.com/v1/storagetrial4937-deoraclegermatrial48847/myContainer

The response is

myObject
5. Show the content of an object

To read out the contents of myObject we need the following command :

curl -X GET -H 'X-Auth-Token: AUTH_tkb7b77d88a63a005ddd9' https://storage.us2.oraclecloud.com/v1/storagetrial4937-deoraclegermatrial48847/myContainer/myObject

The response is

Hello, World!

So much for now.

No comments:

Post a Comment