Search code examples
amazon-web-servicesamazon-ec2aws-cloudformation

Simplest way to automate starting of EC2 daily


I've been looking into ways to have an EC2 start daily at a certain time, and there are many ways, but none seem particularly simple - I am after the simplest way (including GUI based ways). All I want is for an EC2 (with a specific AMI) to start at a set time each day (it will run a boot script and terminate itself once it's done - I do not need help with these parts though).

So my question is, how can I automate the starting of an EC2 daily?

Backgroud info

This excellent answer, shows a way to use cloudformation / instance scheduler. I am open to using these services, however, they might be overkill for the simple use case I have. Also, that answer says the documentation is not well written, which I think is true for users wanting to get started quickly and who don't care so much about region and many other options


Solution

  • You will need to create a Lambda function to start your EC2 plus use CloudWatch Events for scheduling: Schedule Expressions Using Rate or Cron - AWS Lambda