You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

A central cloud service is the ability to store and retrieve objects. An object can for instance be a regular file. The NTNU OpenStack installations (SkyHiGh, stack.it) provides API's for storing and retrieving objects. Objects can be stored with access control, or publicly, depending on the users requirements.

The object storage is realized through an API which is compatible with Amazon S3 and OpenStack Swift.

Using the swift API's

There are three ways to use the swift API's, depending on the need of the user. One can either use the API directly, use the openstack CLI clients or use the Openstack Web-Interface.

Using the Swift API directly

To use the API directly one need to locate the APIs address. One way to get this address is through the use of the OpenStack CLI client command "openstack catalog show swift". This command will print three URL's, and you should use the one listed as "public". The API is documented here.

Using the openstack CLI clients

The openstack CLI clients are getting their configuration from the openstack installation, and is thus ready for use as soon as the client is authenticated. Relevant commands to start using the object storage is:

Openstack swift examples
$ # To create a bucket (container) to store objects in:
$ openstack container create Bøtte

$ # To upload an object (here the file 10MFile.img is uploaded, and called MyObjectName)
$ openstack object create Bøtte 10MFile.img --name MyObjectName

$ # To display available objects
$ openstack object list Bøtte

$ # To delete an object
$ openstack object delete Bøtte MyObjectName

$ # To delete a bucket (container)
$ openstack container delete Bøtte

$ # To delete a bucket (container) with objects
$ openstack container delete Bøtte -r

Using the openstack dashboard (horizon)

After logging in to the openstack dashboard you can select "Object Store → Containers" in the left-hand menu. At that point there are buttons to create containers, setting it public (allowing everyone to list the content of the container and download objects from the container, as long as you give them the URL), and upload/delete objects.

Using the S3 API's

The object store implemented supports API-calls compatible with amazon S3. It is thus possible to use an S3 client to connect to the object storage, but to do this the client need S3 credentials, which is something else than your username and password. To create a set of S3 credentials you would need to use the openstack CLI client:

Create S3 credentials
$ #To create a set of credentials this command can be used:
$ openstack --os-interface public ec2 credentials create

$ # To list the credentials which can access containers belonging to your project, the following command can be used:
$ openstack ec2 credentials list

To actually use the API you should look up a S3 API documentation page. To find the API url you should use the command "openstack catalog show swift", and select the public URL from that command. When using S3 you should remove the "/swift/v1/<project-id" from the url.

  • No labels