Is there a way to test AWS SAM EventBridgeRule rules in template.yaml files?

0

Is there a way to test AWS SAM EventBridgeRule rules in template.yaml files? The tool at URL https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-pattern-sandbox.html only works for JSON. Is there an equivalent tool for YAML?

Jeff
asked 23 days ago78 views
1 Answer
0

Hello.

Since the type of "EventPattern" is JSON, how about embedding the JSON as is and creating a template after testing the event rule?
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-eventpattern

Resources:
  EventRule:
    Type : "AWS::Events::Rule"
    Properties:
      EventPattern:
        {
          example_event...
        }

profile picture
EXPERT
answered 23 days ago
  • Perhaps I was not clear in my problem statement; the event pattern is YAML not JSON. My AWS SAM template is YAML. I currently convert my YAML to JSON using a tool like https://onlineyamltools.com/convert-yaml-to-json and paste the JSON output into the EventBridge sandbox, but that is a kludge. My question is; Does a tool exist to test YAML event patterns?

  • The AWS CLI has a command called "aws events test-event-pattern", but this can only be used with JSON, so I don't think there is currently an official AWS method to check event patterns with YAML. So, I think you can save yourself the trouble of converting by embedding the JSON event pattern in the YAML template as I suggested.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions