Cost Control Using a Schedule PolicyThis blog post is the first in a technical series on using Policies functionality in the Jamcracker platform.
We've all reminded someone (or have been reminded) to "turn the lights off" when leaving a room. The same principle applies in business, especially when looking at cloud resources. The problem is, all too often users just keep virtual machines running 24x7 - the cloud equivalent of leaving the lights on. Running Virtual Machines 24x7 when they are predictably idle at off hours is simply throwing resources and money down the drain.
There are many scenarios where a calendar based policy can help your company curb cloud spend. For example, perhaps your business has production applications that are only used during business hours (8x5 or perhaps 10x5). Perhaps you have some dev/test environments that run nonstop Monday and Tuesday as they execute weekly automated tests. You might have systems running batch processing jobs at weeks-end and sit idle most of the time otherwise. Sometimes, virtual machines are running for days, weeks months, even years after a project ends. In extreme cases, sometimes for so long afterward that nobody has any idea why they were running in the first place.
If any of these scenarios apply to you, then you should consider using a calendar based policy to turn down those systems during times when it would be otherwise idle. In doing so, your business can save money when using public cloud providers, and if running your own private virtualized infrastructure, you can optimize performance and resources for active workloads during these idle times. Consider this: if you run machines 24x7 when their applications are idle on weekends, you are potentially spending 28% more on cloud costs than you need to be.
Cloud Cost Control in the Jamcracker Platform
The Jamcracker platform gives you multiple tools to institute some cost control. For example, showing purchased vs. assigned SaaS licenses in a dashboard, or reports on logins and usage to see how many of those assigned licenses are being used. In this blog post, we look at one specific cost control mechanism provided by the Jamcracker platform, how to use simple Calendar policies that stop and start specific virtual machines on a scheduled basis.
The Jamcracker Policy Engine
The Jamcracker Service Delivery Network (JSDN) platform includes Cloud Management Platform (CMP) functionality that helps businesses manage workloads across both public clouds (AWS, Azure, Softlayer, etc.) as well as private clouds built on VMWare or OpenStack. Jamcracker’s Policy engine works in conjunction with the CMP functionality, giving you automated control over virtual machines and storage volumes. Application Stacks, virtual machine instances and storage volumes can be controlled by Policies, and those policies can be triggered by performance data collected by the Monitoring subsystem, or based on a defined schedule.
Identifying the Workload
When working with virtual machine instances, the Policy Engine uses tags (attribute/value pairs) to select the virtual machines against which the policy should be applied. Up to 10 tags can be assigned to a single virtual machine.
It is important that you tag systems with some consistency. For example, once you identify any machines that can be shut-down on weekends, give them a tag of “Usage=Weekdays”. The actual tag name and value are not important, but using those tags and values consistently is critical.
In the screenshot above, note the use of two tags, one named “Dept” and one named “Usage”. Our Calendar policy will only use the “Usage” tag for our policy, while the “Dept” tag may be used for other purposes such as identifying the group or project that is using the resource.
Setting the Calendar Policy
Setting a Calendar Policy is a simple workflow that takes about a minute. You can access the Policy functionality by clicking on Manage – Policies in the Jamcracker portal.
You can then click on the Add policy icon to add a new policy.>
Filling out the policy is quite straightforward. Give the Policy a Name, and then select what type of object to apply the policy control (an Instance in this case)
Once you select the object type to apply the policy against, the action fields appear.
Enter the tag name (Usage) and value (Weekdays) in the “Filter By” boxes.
In the “Using” field, select “Calendar”.
Then in the “Recurrence” field, select “Weekly”.
Then enter a weekly time like Friday at 8PM (20:00 in 24 hr format).
Lastly select “Stop Server” for the action.
Then click Save & Finish.
To turn the virtual machine back on Monday morning, create a second policy named something like “Weekly startup” that repeats the above steps, except you need to select your start time/day and set the action to “Start Server”
The policies will run automatically, and will turn off any instances with this tag name on weekends, and restart them when the workweek starts.
Now pat yourself on the back for saving your business some cash.