4

I am trying to create a scheduling system for my EC2 instances using lambda functions to start/shutdown the instances and Cloudwatch to trigger and schedule them. The problem is Cloudwatch, not triggering the lambda functions when the functions are working fine. I have linked Cloudwatch to the lambda function, and set it as the trigger. But Cloudwatch logs isn't showing any recollection of the instances changing state and the state of the instances don't change. Can anyone help?

Just to note: I have tested the lambda functions using the test feature, and they both work perfectly. I'm assuming the issue is with Cloudwatch.

Hope
  • 41
  • 3
  • please post all the details about the CloudWatch event etc. You don't have enough details to troubleshoot your issue. – kenlukas Oct 05 '18 at 16:03
  • Hi Hope, if the response below answered your question please upvote and accept it. That's the ServerFault's way to say thank you for the time and effort someone took to help you. Thanks! – MLu Nov 03 '18 at 03:43

1 Answers1

1

It's probably a missing permission for CloudWatch to execute your Lambda. Have you got the CloudWatch Events Lambda triggers configured and enabled?

enter image description here

Have a look at this CloudFormation template that does exactly what you want - starts and stops a given Instance at specified times using CloudWatch Events Rule:

https://github.com/mludvig/ec2-start-stop

Hope that helps :)

MLu
  • 24,849
  • 5
  • 59
  • 86