AWS cloudwatch not triggering lambda function

amazon-cloudwatchamazon-lambdaamazon-web-services

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.

Best Answer

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 :)

Related Topic