This page helps you get started using the jclouds API with SoftLayer.

Currently, SoftLayer offers 3 main “cloud” flavours:

Starting from 1.8.0, Jclouds supports officially only Public Cloud Instances (CCI).

Getting Started

  1. Sign up for SoftLayer Cloud.
  2. Log in to the
  3. Get your Username and API Key:
  4. Ensure you are using a recent version of Java 6.
  5. Setup your project to include softlayer.
    • Get the dependencies org.jclouds.provider/softlayer using jclouds Installation.
  6. Start coding.

SoftLayer Compute

// Get a context with softlayer that offers the portable ComputeService API
ComputeServiceContext computeServiceContext = ContextBuilder.newBuilder("softlayer")
                      .credentials("username", "apiKey")
                      .modules(ImmutableSet.<Module> of(new Log4JLoggingModule(),
                                                        new SshjSshClientModule()))

ComputeService computeService = computeServiceContext.getComputeService();

// List availability zones
Set<? extends Location> locations = computeService.listAssignableLocations();

// List nodes
Set<? extends ComputeMetadata> nodes = computeService.listNodes();

// List hardware profiles
Set<? extends Hardware> hardware = computeService.listHardwareProfiles();

// List images
Set<? extends org.jclouds.compute.domain.Image> image  = computeService.listImages();

NB: "computeService.listImages()" returns operatingSystems from SoftLayer_Container_Virtual_Guest_Configuration.

// Create nodes with templates
Template template = computeService.templateBuilder().osFamily(OsFamily.UBUNTU).build();
Set<? extends NodeMetadata> groupedNodes = computeService.createNodesInGroup("myGroup", 2, template);

// Reboot images in a group

TemplateOptions and SoftLayerTemplateOptions

In jclouds, the standard mechanism to specify template options is by using the TemplateBuilder. This supports a number of configuration supported by all the api/provider jclouds

For example, the location id is used to specify the "region" provider where to spin your VM:

TemplateBuilder templateBuilder = context.getComputeService().templateBuilder();

If you need to specify a public image supported by SoftLayer can be referenced as follows:


If you want instead to specify a private image, you need to set the globalIdentifier of a VirtualGuestBlockDeviceTemplateGroup, like:


Notice, if you don't know the globalIdentifier upfront you can use the following curl command:

curl -uusername:apiKey

and use the globalIdentifier desired

jclouds is able to leverage SoftLayer CCI specific-options described at createObject by doing the following:

SoftLayerTemplateOptions options = template.getOptions().as(SoftLayerTemplateOptions.class);
// domain
// multi-disk
options.blockDevices(ImmutableList.of(25, 400, 400));
// disk type (SAN, LOCAL)

NB: notice, vlandId and backendVlanId should be the internal IDs and not the vlan number! One can easily retrieve it from the SoftLayer web UI by clicking on VLAN number link of The url will show something like where the vlanId is 1234567

Provider-specific APIs

When you need access to SoftLayer features, use the provider-specific context

SoftLayerApi api = computeServiceContext.unwrapApi(SoftLayerApi.class);
// and then get access to the delegate API groups

// Be sure to close the context when done

SoftLayer Object Storage

SoftLayer Object Storage is an OpenStack® based blobstore storage system.

// Get a context with softlayer that offers the portable BlobStore API
BlobStoreContext context = ContextBuilder.newBuilder("swift")
                 .credentials("tenantName:accessKey", "apiKey)

// Create a container in the default location
context.getBlobStore().createContainerInLocation(null, container);

// Be sure to close the context when done

For more examples, see Openstack documentation.