Passing data to Automation using input transformers - Amazon Systems Manager
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Passing data to Automation using input transformers

This Amazon Systems Manager Automation tutorial shows how to use the input transformer feature of Amazon EventBridge to extract the instance-id of an Amazon Elastic Compute Cloud (Amazon EC2) instance from an instance state change event. Automation is a capability of Amazon Systems Manager. We use the input transformer to pass that data to the AWS-CreateImage runbook target as the InstanceId input parameter. The rule is triggered when any instance changes to the stopped state.

For more information about working with input transformers, see Tutorial: Use Input Transformer to Customize What is Passed to the Event Target in the Amazon EventBridge User Guide.

Before you begin

Verify that you added the required permissions and trust policy for EventBridge to your Systems Manager Automation service role. For more information, see Overview of Managing Access Permissions to Your EventBridge Resources in the Amazon EventBridge User Guide.

To use input transformers with Automation
  1. Open the Amazon EventBridge console at

  2. In the navigation pane, choose Rules.

  3. Choose Create rule.

  4. Enter a name and description for the rule.

    A rule can't have the same name as another rule in the same Region and on the same event bus.

  5. For Event bus, choose the event bus that you want to associate with this rule. If you want this rule to respond to matching events that come from your own Amazon Web Services account, select default. When an Amazon Web Service in your account emits an event, it always goes to your account’s default event bus.

  6. For Rule type, choose Rule with an event pattern.

  7. Choose Next.

  8. For Event source, choose Amazon events or EventBridge partner events.

  9. In the Event pattern section, choose Event pattern form.

  10. For Event source, choose Amazon services.

  11. For Amazon service, choose EC2.

  12. For Event type, choose EC2 Instance State-change Notification.

  13. For Specific state(s), choose stopped.

  14. Choose Next.

  15. For Target types, choose Amazon service.

  16. For Select a target, choose Systems Manager Automation.

  17. For Document, choose AWS-CreateImage.

  18. In the Configure automation parameter(s) section, choose Input Transformer.

  19. For Input path, enter {"instance":"$.detail.instance-id"}.

  20. For Template, enter {"InstanceId":[<instance>]}.

  21. For Execution role, choose Use existing role and choose your Automation service role.

  22. Choose Next.

  23. (Optional) Enter one or more tags for the rule. For more information, see Tagging Your Amazon EventBridge Resources in the Amazon EventBridge User Guide.

  24. Choose Next.

  25. Review the details of the rule and choose Create rule.