Step Function End Point
Implement an EventBridge rule to target Step Functions
Use the EventBridge Console to:
Add a rule to the Orders event bus with the name "EUOrdersRule"
Define an event pattern to match events with a detail location in "eu-west or eu-east".
{ "source": [ "com.aws.orders" ], "detail": { "location": [ "eu-west", "eu-east" ] } }
Target the OrderProcessing Step Functions state machine
You can refer this simple sample event to create your event pattern:
{ "version": "0", "id": "6e6b1f6d-48f8-5dff-c2d2-a6f22c2e0086", "detail-type": "Order Notification", "source": "com.aws.orders", "account": "111111111111", "time": "2020-02-23T15:35:41Z", "region": "us-east-1", "resources": [], "detail": { "category": "office-supplies", "value": 300, "location": "eu-west" } }
make sure to enclose every value in any array or an object format or else it'll generate an "Event Patern is not valid " error. For example :
"version" : ["0"]
Also, make sure to write the target service ARN in resource and fill the account and region with your AWS account number and region you choose for the project.
Send test EU Orders events
To verify our event is reached to it's desired destination (Step Function) we'll generate an event using Event Generator and send the following "Order Notification" events from the source "com.aws.orders":
{ "category": "office-supplies", "value": 300, "location": "eu-west" }
{ "category": "tech-supplies", "value": 3000, "location": "eu-east" }
Verify Step Functions workflow execution
If the event sent to the Orders event bus matches the pattern in your rule, then the event will be sent to the OrderProcessing Step Functions state machine for execution.
Open the AWS Management Console for Step Function.
On the Step Functions homepage, open the left hand navigation and select State machines.
Enter OrderProcessing in the Search for state machines box and verify the state machine execution has succeeded.
Note :
If you are not seeing any executions in your OrderProcessing state machine after successfully publishing an event, it is possible that there is an issue with the event or with the configuration of the state machine. Here are a few things to check:
Verify that the event was published to the correct EventBridge bus and with the correct event pattern. Make sure that the event pattern you used to create the target for your state machine matches the event that was published.
Check the CloudWatch logs for the state machine to see if there were any errors or exceptions that prevented the state machine from being triggered by the event.
Check the state machine definition to verify that it is correctly configured to listen to events from EventBridge. Ensure that the state machine is set up as a target for the EventBridge rule that you created.
Verify that the IAM role associated with the state machine has the necessary permissions to access EventBridge and start executions.
Check the event details in the EventBridge console to see if there were any errors or issues with the event.
By checking these factors, you should be able to identify and resolve the issue with the executions not appearing in your OrderProcessing state machine.
And upto this point we have successfully completed a Step Function event task.
And now we have to use the similar approach for SNS Topic, let's take a deep dive.