D. Stri
D. Stri

Reputation: 1

What's the best method for creating a scheduler for running EC2 instances?

I want to create a web app for my organization where users can schedule in advance at what times they'd like their EC2 instances to start and stop (like creating events in a calendar), and those instances will be automatically started or stopped at those times. I've come across four different options:

  1. AWS Datapipeline
  2. Cron running on EC2 instance
  3. Scheduled scaling of Auto Scaling Group
  4. AWS Lambda scheduled events

It seems to me that I'll need a database to store the user's scheduled times for autostarting and autostopping an instance, and that I'll have to pull that data from the database regularly (to make sure that's the latest updated schedule). Which would be the best of the four above options for my use case?

Edit: Auto Scaling only seems to be for launching and terminating instances, so I can rule that out.

Upvotes: 0

Views: 268

Answers (2)

cparlette
cparlette

Reputation: 1

Take a look at ParkMyCloud if you're looking for an external SaaS app that can help your users easily schedule (or override that schedule) your EC2, RDS, and ASG instances. It also connects to SSO, provides an API, and shows you all of your resources across regions/accounts/clouds. There's a free trial available if you want to test it out.

Disclosure: I work for ParkMyCloud.

Upvotes: 0

John Rotenstein
John Rotenstein

Reputation: 270224

Simple!

  1. Ask users to add a tag to their instance(s) indicating when they should start and stop (figure out some format so they can easily specify Mon-Fri or Every Day)
  2. Create an AWS Lambda function that scans instances for their tags and starts/stops them based upon the tag content
  3. Create an Amazon CloudWatch Event rule that triggers the Lambda function every 15 minutes (or whatever resolution you want)

You can probably find some sample code if you search for AWS Stopinator.

Upvotes: 3

Related Questions