I have a event in CloudWatch, which is triggered once a day. Is there a way to trigger the event manually (for testing purposes)?
...I realize I can increase the frequency of the event's triggering schedule.
I have a event in CloudWatch, which is triggered once a day. Is there a way to trigger the event manually (for testing purposes)?
...I realize I can increase the frequency of the event's triggering schedule.
If you have a cloudwatch alarm set up, using the AWS CLI you can, for testing purposes, set the alarm state of that alarm:
aws cloudwatch set-alarm-state --alarm-name "myalarm" --state-value ALARM --state-reason "testing purposes"
see the docs here
Alternatively you can put a custom event, also using the CLI or the SDKs
I haven't found (and I don't think it is possible) to trigger a scheduled trigger manually. But as danimal mentions you can put a custom event to trigger it.
# update your rule to trigger on a dummy-event source
# put-rule updates a rule if it exists or creates a new one if it doesn't
aws events put-rule --name "my-rule" --event-pattern "{\"source\":[\"karlanka\"]}"
# send an event with the same dummy source to trigger the rule
# Detail and DetailType are required but not used
aws events put-events --entries '[{"Source":"karlanka","DetailType":"X","Detail":"{}"}]'
# then change the rule back to your schedule
aws events put-rule --name "my-rule" --schedule-expression "rate(12 hours)"