Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trigger AWS CloudWatch Event Manually

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.

like image 537
Adam Avatar asked Sep 20 '19 19:09

Adam


People also ask

How do you trigger the CloudWatch event rule?

To create a rule that triggers on an event:Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/ . In the navigation pane, choose Events, Create rule. For Event source, do the following: Choose Event Pattern, Build event pattern to match events by service.

How do I trigger AWS CloudWatch alarm?

Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . In the navigation pane, choose Instances. Select the instance and choose Actions, Monitor and troubleshoot, Manage CloudWatch alarms. On the Manage CloudWatch alarms detail page, under Add or edit alarm, select Create an alarm.

How do you test the CloudWatch event rule?

To test your ruleOpen the CloudWatch console at https://console.aws.amazon.com/cloudwatch/ . In the navigation pane, choose Events, Rules, select the name of the rule that you created, and choose Show metrics for the rule.


2 Answers

Another solution I found is to disable then re-enable the rule:

aws events disable-rule --name "my_scheduled_rule"
aws events enable-rule --name "my_scheduled_rule"

Perhaps not the best route but an option...

like image 23
dspeckleback Avatar answered Sep 18 '22 09:09

dspeckleback


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

like image 74
danimal Avatar answered Sep 21 '22 09:09

danimal