Scheduling cloud resources for teams
A DevOps team needs quick and convenient access to servers, databases, containers, load balancers and many other resources. However, many of these are not required 24x7 — a large number may only be required for a small percentage of time.
During a normal work week, development, staging and test resources may only be used for 40–60 hours out of a total of 168 hours in the week.
Most cloud providers charge based on your usage — i.e. for the time you have resources powered up. If you schedule those resources to be powered down when not required, you can realize savings of up to 70% of your total cloud spend.
Cron, Bash and a dash of Slack
The lure of those savings is like a siren song. Surely a simple cron and bash script can schedule the resources to be powered up during work hours and otherwise powered down? Sounds simple, lets code … but wait …
A simple cron schedule will invoke a bash script, that calls the AWS CLI to power down a list of instances. But when should the instances be on and off?
What if the team is geographically dispersed?
If you have flexible or remote workers, that answer will definitely not be a simple 9AM — 5PM. If some team members are in a different time zone, that must be factored in as well. Perhaps a Slack poll will do the trick … just ask everyone what their hours are.
But what about one-off work crunches? What if schedules changes? What if a worker decides they are more productive today by working till 2:00 am?
A trivial cron schedule and bash script is just too inflexible.
Achieving those elusive savings with cron and bash rarely works beyond the initial demo. It is difficult to keep track of cloud resource requirements when teams are dispersed and needs are fluid.
AWS Instance Scheduler
Perhaps the AWS Instance Scheduler can rescue the situation? The AWS scheduler is a bundled solution using, Lambda, SNS and CloudWatch components and is deployed into your account via a rather complex CloudFormation template. The scheduler will start and stop resources according to custom schedules executed via the Lambda script.
Unfortunately the AWS Instance Scheduler, while implemented with “cooler” components, suffers from the same problem as the cron/bash solution. The resource schedule must be manually created. You still need to work out and maintain when the users need each resource in a common reference time zone. Thereafter, the schedule is fixed.
What is needed is a dynamic schedule that automatically changes as user needs evolve.
A dynamic schedule automatically combines user requirements into a single schedule — one schedule to rule them all. This schedule must continuously adapt and change in real-time without manual coordination as user needs evolve.
A dynamic schedule is driven by two key user inputs:
per-user availability requirements for cloud resources
per-user overtime or override needs
Each user is empowered to define their own schedule for a resource or group of resources. One user may need the “test” environment to be available 9–5 PDT whereas another user may need “test” between 7–7 CDT. The dynamic schedule should automatically aggregate these overlapping schedules.
If the first user then works late, it should be trivial for a user to say “I need test for an additional 4 hours tonight.”
PowerDown is a cloud optimizer tool that implements dynamic schedules to lower cloud costs by powering down servers, databases and containers. It is especially effective for dispersed teams.
PowerDown’s dynamic schedules support each user describing exactly when they need a resource or resource group to be available. Users specify the required hours for the resource in their own time zone via a weekly grid with an optional start and/or end date. They can modify their schedule anytime without coordinating with other team members and their changes will immediately update the master dynamic schedule.
What about the unexpected?
For unexpected work, users can quickly override their schedules to demand that a request or resource group be immediately powered up for a duration or until a designated time.
The end result is a simple and painless solution that dramatically lowers cloud costs by effectively powering up and down resources regardless of the constantly changing needs of a dispersed team.
If any user needs a resource to be available, it will be powered up. If the resource is not required, PowerDown will power down the resource until it is needed whereupon it will be restarted. And, naturally, you only pay when you save. No subscription or one-off charges.
As an added bonus: PowerDown understands the dependencies between resources so users can schedule entire environments with a single command. To learn more about these resource groups, read: PowerDown Resource Groups.