Instance Scheduler

By
In 
aws
ec2
Published 2022-10-19
Guide to setup Instance scheduler to schedule your EC2 hours


Setting up AWS Instance Scheduler to save EC2 instance costs for your dev/uat servers.

Use Case

When you have EC2 instances which are running when not needed (outside of work hours, on holidays, etc.) and billing you for it, Instance Scheduler will help you cut down on these costs by reducing the uptime of the server instance by shutting it down with a schedule but also conveniently bringing it back when needed (as scheduled).

Instructions

Set up Instance Scheduler in CloudFormation

On that page, you could change any options you want, but we'll keep the defaults and click Next.

  • Frequency depends on what you would schedule your timtings as. If you're doing something like 08:00 to 18:00, then I think a 60 minute frequency is good enough.
  • You could enable CloudWatch logs and metrics if you need. Do add Started tags and Stopped tags, this would help you differentiate between Manual starts of the instance vs Instance Scheduler's.

DynamoDB Setup

EC2 Tags

Note: The tag key should be the same name as the CloudFormation Stack for the instance scheduler. The tag key for my setup is dev-scheduler

Testing

Enjoy saving $$$, cheers!