The Rackspace Cloud SDK for Java
At the OpenStack Grizzly Summit in October 2012, Rackspace announced our Java Software Development Kit (SDK) for the open cloud. The Java SDK is powered by jclouds, an open source library that helps you get started in the cloud and employ your Java development skills. The jclouds Application Programming Interface (API) gives you the freedom to write portable code that works with many cloud providers or write code that utilizes cloud specific features. It also works with both public and private clouds, enabling hybrid cloud workloads. <!-- more --> To get started head over to the Rackspace Cloud SDK for Java. If you're looking for an SDK for another language, please have a look at the Introduction to all of our SDKs.
There are many benefits of using a Rackspace SDK:
- Coding in the language of your choice.
- Working with production tested code.
- Documentation on how to use the SDK.
- Examples that you can use as a starter kit for your own cloud applications.
- Engaging an established community of developers.
- Avoiding writing "plumbing" code to handle the HTTP level details.
- You only need one SDK for all Rackspace Cloud products.
- Interoperability with OpenStack
It's clear, using an SDK accelerates development and gives developers the most bang for their buck when it comes to learning new skills.
Because jclouds works across many cloud providers there are some differences in terminology and when writing portable cross-cloud code.
Some cloud features, such as compute and object storage, have jclouds APIs that allow you to write code that is portable across different clouds. In order to take advantage of this portability you would write your Java code to the ComputeService and BlobStore APIs. To take advantage of Rackspace cloud specific features, such as changing your administrator password on a server or making a file available via a content distribution network, you would code to the ServerApi and CloudFilesClient APIs. There are also certain cloud features that have no portable API, such as block storage, where the only option is to use the VolumeApi.
It's also worthwhile to note that many of the jclouds APIs that you would use to work with the Rackspace open cloud are actually using the OpenStack API under the hood. This is because many of the Rackspace open cloud services are powered by OpenStack. For example, Rackspace Cloud Block Storage is powered by the OpenStack Cinder project, hence when you get an instance of the VolumeApi to create a block storage volume, you first access it via the CinderApi with
CinderApi.getVolumeApiForZone(String). This is made clear in the example code discussed below. These APIs work across all public and private OpenStack powered clouds, for more info read jclouds and OpenStack.
So you can view jclouds as having 3 distinct layers of APIs.
|OpenStack||NovaApi, ServerApi, CinderApi, VolumeApi|
You can find all of the APIs referenced above in the latest jclouds Javadoc.
After reading through the Getting Started guide, I find one of the best ways to learn a new technology is to start by running some examples yourself. The Rackspace SDKs have well tested examples in spades. For jclouds, you can find instructions on how to run them from the command line or Eclipse at Rackspace Examples.
Start with the rackspace package. There you will find general purpose examples of things that are useful across all services.
- Logging.java - How to enable and configure logging. See what jclouds is sending across the wire. Essential for debugging, troubleshooting, and getting help!
- Authentication.java - How you can use your credentials to authenticate with the Rackspace open cloud.
The cloudfiles package demonstrates how to accomplish common tasks for putting files in and getting files from the cloud.
- CloudFilesPublish.java - An end to end example of publishing a file on the internet with Cloud Files.
- Other examples of creating, updating, listing, and deleting containers/objects.
The cloudservers package demonstrates how to accomplish common tasks for working with servers in the cloud.
- CloudServersPublish.java - An end to end example of publishing a web page on the internet with Cloud Servers.
- Other examples of creating, manipulating, listing, and deleting servers.
The cloudblockstorage package demonstrates how to accomplish common tasks for working with block storage (aka volumes) in the cloud.
- CreateVolumeAndAttach.java - An end to end example of creating a volume, attaching it to a server, putting a filesystem on it, and mounting it for use to store persistent data.
- Other examples of creating, manipulating, listing, and deleting volumes and snapshots.
I have been working with jclouds for a while now and I’ve been thoroughly impressed by their commitment to quality and community. It’s a well maintained project with a bright future. Pull request #1000 was merged just one week ago!
If you need a hand or encounter any troubles, I invite you to join the jclouds group or file an issue. If you’re interested in contributing, read about Contributing to the jclouds Code Base. We love to get feedback too so for general feedback and support requests, you can send an email to firstname.lastname@example.org.