Menu
Amazon CloudWatch Events
User Guide

Tutorial: Set Amazon EC2 Systems Manager Automation as a CloudWatch Events Target

You can use CloudWatch Events to invoke Amazon EC2 Systems Manager Automation on a regular timed schedule, or when specified events are detected. This tutorial assumes you are invoking Systems Manager Automation based on certain events.

To create the CloudWatch Events rule

  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 and choose Build event pattern to match events by service.

    2. For Service Name and Event Type, choose the service and event type to use as the trigger.

      Depending on the service and event type you choose, you may need to specify additional options under Event Source.

  4. For Targets, choose Add Target, SSM Automation.

  5. For Document, choose the Systems Manager document to run when the target is triggered.

  6. (Optional), To specify a certain version of the document, choose Configure document version.

  7. Under Configure parameter(s), choose No Parameter(s) or Constant.

    If you choose Constant, specify the constants to pass to the document execution.

  8. 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.

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

  10. Choose Create rule.