How to Enable Instance Scheduler with StackZone

Manage when your EC2 Instances turn off and turn on via tags

Ryan Ware

Last Update 10 months ago

This article will explain how you can enable Instance Scheduler within StackZone and what it can do for your EC2 Instances within your AWS Accounts.

What Is An Instance Scheduler?

An Instance Scheduler is a great way to save costs for your fleet of EC2 Instances launched within your AWS Accounts. AWS EC2 Instances are billed per hour for the time they are "up". Have you ever considered the money you would save if you powered down your Instances on the weekend if nobody is working on them? Or perhaps Dev Instances outside of working hours during the week?


This is what an Instance Scheduler aims to perform for you. Please note that the StackZone Instance Scheduler can extend towards RDS Instances here, as well as the EC2 Instances already mentioned.


At the time of writing, StackZone offers an "OfficeHours" schedule which you can apply to this feature of your own StackZone. If an EC2 Instance is "on", the Instance Scheduler will power this down on weekdays at 18:00 and power it back on the next weekday at 08:00. The weekend times differ slightly, with the box being turned on at 09:00 and powered down again at 17:00


You can apply this schedule to any number of Instances, just by tagging it.


StackZone Configuration

To configure your own StackZone Instance Scheduler, you will need to tell the feature how and what you want to Schedule with StackZone. 


In the StackZone Console UI, as shown below, head to AWS / Baseline Services / Instance Scheduler. You can toggle this feature on and then configure it based on your preferences.


By Default, the StackZone Instance Scheduler will manage both RDS and EC2 Instances. It will build the Lambda Function and DynamoDB required for this solution, so that we can automatically track which instances are to be managed this way, and their current state (Are they currently off or on?)


We will also by default create a snapshot of any RDS Instance powered down this way before turning off, along with constructing all the necessary IAM roles required to make the components of this solution work.

Added in v4.18.0! 


This feature was also improved in StackZone v4.18.0 so that the configuration for each Instance Scheduler managed scheduler can be set to a particular timezone. This means you have have an "office-hours-US" schedule constructed which operates between 09:00 - 17:00 but you explicitly set the timezone to be America/Los_Angeles for example


Valid Timezones:

- "Africa/Johannesburg"

- "America/Argentina/Buenos_Aires"

- "America/La_Paz"

- "America/Lima"

- "America/Los_Angeles"

- "America/Mexico_City"

- "America/New_York"

- "America/Panama"

- "America/Santiago"

- "America/Sao_Paulo"

- "Asia/Bahrain"

- "Asia/Dubai"

- "Asia/Hong_Kong"

- "Asia/Jakarta"

- "Asia/Jerusalem"

- "Asia/Seoul"

- "Asia/Singapore"

- "Asia/Tokyo"

- "Australia/Perth"

- "Australia/Sydney"

- "Canada/Central"

- "Europe/Dublin"

- "Europe/London"

- "Europe/Madrid"

- "Europe/Paris"

- "GMT"

- "US/Central"

- "US/Eastern"

- "US/Pacific"

- "UTC"


Just Add Tags!

Once you have enabled the Instance Scheduler within StackZone and deployed the changes to your AWS Account, all you need to do is use the EC2 Instance Tags to declare the schedule you'd like to apply to this resource, and the "ScheduleStarted" or "ScheduleStopped" tags will be added to the resource additionally, once the corresponding Lambda Function has triggered.


This function will start or stop the resource, depending on the tags currently applied, and the schedule. It will then change the tag so it is aware of the resource's current power state, and can change it again depending on the schedule applied to the resource.


F.A.Q.

Q: Are there any constraints for my Schedule Begin Time and End Time?

A: Yes. Your Begin Time must not be later than your End Time in terms of a 24 Hour Clock. For example, you cannot have a Begin Time of 14:00 if your End Time is 10:00


Q: What is the expected format for the input "Weekdays"

A: Your Weekdays input should be in the format of three letters for each weekday when the schedule starts and ends, separated by a hyphen.


So you would choose Mon-Fri if you want a weekday schedule. Choose Sat-Sun for a weekend schedule. Or you can use Wed-Wed if you want the operation to only be for one day, which would be wednesday.


Want to know more about StackZone and how to make your cloud management simple and secure?

Check our how it works section with easy to follow videos or just create your own StackZone Account here

Was this article helpful?

0 out of 0 liked this article

Still need help? Message Us