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.
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.
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:
|Connect To SoftLayer||
|Disconnect From SoftLayer||
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.
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).
In the next blog we will explore some additional activities of the SoftLayer Activity Library for Citrix Workflow Studio. Stay tuned!
- SoftLayer Activity Library Download
- Getting Started
- Ordering instances on SoftLayer
- Checking status of instances on SoftLayer
- Cancelling instances on SoftLayer (this one)
- Creating templates on SoftLayer
Ask-the-Architect Site: http://community.citrix.com/p/product-automation#home
Follow Me on twitter: http://twitter.com/citrixedy