Another common use of the SoftLayer Activity Library for Citrix Workflow Studio is to cancel instances on your SoftLayer account when you no longer need them. SoftLayer provides both hourly and monthly billing of their Cloud Computing Instances (CCIs), and you are being charged a fee as long as that CCI remains present. Even if you just “shut down” the virtual machine, as long as that CCI is still there you are being charged since that VM is consuming space and resources at SoftLayer. So cancelling instances after use becomes critical to control the cost of your SoftLayer account.

In the last blog, I discussed how you can create a workflow to retrieve information about a Cloud Computing Instance (CCI) on SoftLayer. In this blog, we will create a workflow for cancelling an instance. To download the SoftLayer activity library and get started, view the setup instructions listed here. To view the full list of blogs within this blog series, refer to the bottom of this article.

First Step – Obtain the Instance ID for the instance
To cancel an instance on SoftLayer, we need to know the Instance ID for the instance. In the previous blog, we used the SoftLayer Activity Library for displaying the instance details in a message box. The Instance ID was one of the details that we retrieved.

If you have experience in using the SoftLayer portal, you’ll notice that when they display the list of Cloud Computing Instances (CCIs) for your account on the web page, each link contains the Instance ID for that instance. This is another way you can retrieve the Instance ID for the instance that you want to cancel.

Second Step – Create the workflow
Open the Workflow Studio Console and create a new workflow called CancelInstance. Within the Workflow Studio Designer, drag the Connect To SoftLayer, Cancel Instance, Message Box, and Disconnect From SoftLayer activities to the designer surface as shown below. The Message Box activity can be found within the Workflow Control activity library section. The other three activities are all part of the SoftLayer activity library section.

Configure the activities as noted in the table below:

Activity Configuration
Connect To SoftLayer
  • API Key – specify the API Key from your SoftLayer account
  • Username – specify your API Username from your SoftLayer account
Cancel Instance
  • Connection – select the output of the Connect to SoftLayer activity
  • Instance ID – input the Instance ID for the instance that you want to cancel
Message Box
  • Message Text – select the output of the Cancel Instance activity as shown in the screen shot below
  • Window Title – specify a title for the message box such as Cancel Details
Disconnect From SoftLayer
  • Connection – select the output of the Connect to SoftLayer activity

The purpose of inserting the Message Box activity into this sample workflow is to allow us to view the status of the cancellation. In a true workflow, I would definitely recommend storing this status into a SQL Server database or wherever you are storing data about this instance. The SQL Server Activity Library can be used for executing commands on a SQL database for storing this data. The key point is that the cancellation status should be retained so that it can used for displaying within your applications.

Third Step – Run the workflow
Run the workflow within the Designer. Ensure that it succeeds properly. A message box should be displayed containing the status of the cancellation (true or false).

Next Steps
In the next blog we will explore some additional activities of the SoftLayer Activity Library for Citrix Workflow Studio. Stay tuned!

Blogs in this series

Ed York – Architect – Worldwide Technical Readiness
Ask-the-Architect Site:
Follow Me on twitter: