Skip to main content

Command Palette

Search for a command to run...

Step Function End Point

Updated
•3 min read•View as Markdown
A

Adil a final year Computer Science student poised to make a mark in the tech world. With a diverse experience in the field of Cloud ,MLOPS and AWS tool's and technologies, Adil navigates the intersection of academia and real-world tech challenges.

Driven by a passion for innovation, Adil expands skills into DevOps, mastering Linux, Docker, and Kubernetes. This journey culminates in securing an internship at AI Planet, specializing in MLOps. Adil's impactful contributions include optimizing GenAI stack deployment with Terraform, Ansible, and implementing creative solutions like KEDA, Prometheus & Grafana to reduce model cold start times.

These experiences mark the beginning of a promising career journey for Adil, blending technical prowess with a passion for tackling real-world challenges.

Implement an EventBridge rule to target Step Functions

Use the EventBridge Console to:

  1. Add a rule to the Orders event bus with the name "EUOrdersRule"

  2. 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"
         ]
       }
     }
    
  3. 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.

    StepFunction

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.

  1. Open the AWS Management Console for Step Function.

  2. On the Step Functions homepage, open the left hand navigation and select State machines.

    State Machine

  3. Enter OrderProcessing in the Search for state machines box and verify the state machine execution has succeeded.

    Step Function

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:

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

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

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

  4. Verify that the IAM role associated with the state machine has the necessary permissions to access EventBridge and start executions.

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

AWS Event Driven Architecture

Part 4 of 6

In this series, we'll build the event driven architecture using AWS Event Bridge which will pass the event generated from event generator to different end points viz API Gateway, SQS and Step Function

Up next

SNS End Point

Our primary goal is to process only orders from US locations (us-west or us-east) that are lab-supplies using a Amazon SNS target (Orders). Similar to the previous use case, but using SNS. let's go for it!! Implement an EventBridge rule to target SNS...

More from this blog

Untitled Publication

14 posts