Search code examples
amazon-web-servicesstate-machineaws-step-functionsaws-event-bridge

AWS Step Functions not triggering "Step Functions Execution Status Change"


I have a state machine in AWS Step Functions and I want to monitor every time that machine starts, as well as when it ends for any reason (success, failure, etc.). According to the AWS documentation each time a state machine status changes it generates an event that I can capture by using an Event Bus Rule.

I have created an event rule as follows:

{
  "detail": {
    "stateMachineArn": ["MY STATE MACHINE ARN"]
  },
  "detail-type": ["Step Functions Execution Status Change"],
  "source": ["aws.states"]
}

Regardless this, it does not matter how many times I start the execution of the state machine, the rule is never triggered.

If I look in Cloud Trail, I can see the event of my user performing StartExecution, but not the event of the step functions execution status change.

I thought I would have something to do with CloudWatch logging for the state machine being disabled, so I turned it on at ALL level, but this has not helped.

Does any of you have an idea of what I could be doing wrong?

Thanks in advance!


Solution

  • After some investigation, it was found that these events are not getting delivered to custom eventbridge but does deliver to "default" eventbridge where rule is same for custom vs default eventbridge. May be a bug because I tried to find any configuration delivering this to default eventbridge but nothing had been found.

      {
      "source": ["aws.states"],
      "detail-type": ["Step Functions Execution Status Change"],
      "detail": {
        "status": ["RUNNING", "SUCCEEDED", "FAILED", "TIMED_OUT", "ABORTED"],
        "stateMachineArn": ["arn:aws:states:<region>:123456789:stateMachine:<stateMachine>"],
        "executionArn": [{
          "prefix": "arn:aws:states:<region>:123456789:execution:<stateMachine>:"
        }]
      }
    }