Creating a CloudWatch Events Rule That Triggers on a Schedule - Amazon CloudWatch Events

Creating a CloudWatch Events Rule That Triggers on a Schedule

Note

Amazon EventBridge is the preferred way to manage your events. CloudWatch Events and EventBridge are the same underlying service and API, but EventBridge provides more features. Changes you make in either CloudWatch or EventBridge will appear in each console. For more information, see Amazon EventBridge.

Use the following steps to create a CloudWatch Events rule that triggers on a regular schedule.

To create a rule that triggers on a regular schedule

  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, choose Schedule.

  4. Choose Fixed rate of and specify how often the task is to run, or choose Cron expression and specify a cron expression that defines when the task is to be triggered. For more information about cron expression syntax, see Schedule Expressions for Rules.

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

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

  7. For many target types, CloudWatch Events needs permissions 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.

  8. Optionally, repeat steps 5-7 to add another target for this rule.

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

    The rule name must be unique within this Region.

  10. Choose Create rule.