Menu
Amazon CloudWatch Events
User Guide

Creating a CloudWatch Events Rule That Triggers on an Event

Use the following steps to create a CloudWatch Events rule that triggers on an event emitted by an AWS service.

To create a rule that triggers on an event:

  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. In the navigation pane, choose Events, Create rule.

  3. For Event source, do the following:

    1. Choose Event Pattern, Build event pattern to match events by service.

    2. For Service Name, choose the service that emits the event that should to trigger the rule.

    3. For Event Type, choose the specific event that is to trigger the rule. If the only option is AWS API Call via CloudTrail, the selected service does not emit events and you can only base rules on API calls made to this service. For more information about creating this type of rule, see Creating a CloudWatch Events Rule That Triggers on an AWS API Call Using AWS CloudTrail.

    4. Depending on the service emitting the event, you may see options for Any... and Specific.... Choose Any... to have the event trigger on any type of the selected event, or choose Specific... to choose one or more specific event types.

  4. For Targets, choose Add Target, then choose the AWS service that is to act when an event of the selected type is detected.

  5. In the other fields in this section, enter information specific to this target type, if any is needed.

  6. For many target types, CloudWatch Events needs permission to send events to the target. In these cases, CloudWatch Events can create the IAM role needed for your event to run:

    • To create an IAM role automatically, choose Create a new role for this specific resource.

    • To use an IAM role that you created before, choose Use existing role.

  7. Optionally, repeat steps 4-6 to add another target for this rule.

  8. Choose Configure details. For Rule definition, type a name and description for the rule.

  9. Choose Create rule.