**To create CloudWatch Events rules** This example creates a rule that triggers every day at 9:00am (UTC). If you use put-targets to add a Lambda function as a target of this rule, you could run the Lambda function every day at the specified time:: aws events put-rule --name "DailyLambdaFunction" --schedule-expression "cron(0 9 * * ? *)" This example creates a rule that triggers when any EC2 instance in the region changes state:: aws events put-rule --name "EC2InstanceStateChanges" --event-pattern "{\"source\":[\"aws.ec2\"],\"detail-type\":[\"EC2 Instance State-change Notification\"]}" --role-arn "arn:aws:iam::123456789012:role/MyRoleForThisRule" This example creates a rule that triggers when any EC2 instance in the region is stopped or terminated:: aws events put-rule --name "EC2InstanceStateChangeStopOrTerminate" --event-pattern "{\"source\":[\"aws.ec2\"],\"detail-type\":[\"EC2 Instance State-change Notification\"],\"detail\":{\"state\":[\"stopped\",\"terminated\"]}}" --role-arn "arn:aws:iam::123456789012:role/MyRoleForThisRule"
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
delete-rule.rst | File | 161 B | 0644 |
|
describe-rule.rst | File | 193 B | 0644 |
|
disable-rule.rst | File | 181 B | 0644 |
|
enable-rule.rst | File | 189 B | 0644 |
|
list-rule-names-by-target.rst | File | 277 B | 0644 |
|
list-rules.rst | File | 381 B | 0644 |
|
list-targets-by-rule.rst | File | 204 B | 0644 |
|
put-events.rst | File | 739 B | 0644 |
|
put-rule.rst | File | 1.04 KB | 0644 |
|
put-targets.rst | File | 999 B | 0644 |
|
remove-targets.rst | File | 321 B | 0644 |
|
test-event-pattern.rst | File | 479 B | 0644 |
|