{"id":277,"date":"2024-06-08T17:59:07","date_gmt":"2024-06-09T00:59:07","guid":{"rendered":"http:\/\/184.72.63.26\/?p=277"},"modified":"2024-10-01T13:10:38","modified_gmt":"2024-10-01T20:10:38","slug":"building-a-serverless-event-driven-order-fulfillment-system-part-1","status":"publish","type":"post","link":"https:\/\/www.wallacel.com\/index.php\/2024\/06\/08\/building-a-serverless-event-driven-order-fulfillment-system-part-1\/","title":{"rendered":"Building a Serverless Event-Driven Order Fulfillment System using AWS EventBridge (Part 1)"},"content":{"rendered":"\n<p>In this blog post, I will walk through the journey to build a simple order fulfillment system using an Event-Driven Architecture (EDA). EDA is an architecture pattern designed to decouple and decentralize application components by allowing loosely couple services to communicate through asynchronously publishing and subscribing to events via an event router. EDA offers several advantages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Loose coupling<\/strong>: Components operate independently and their changes do not affect others as long as their interface remain the same. This enhances modularity and making it easier to add new services to the system. <\/li>\n\n\n\n<li><strong>Scalability<\/strong>: Components can be added or modified easily to bring in new functionalities or scaled horizontally according to demands.<\/li>\n<\/ul>\n\n\n\n<p> My simple order fulfillment system consists of the following processes:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>API endpoint that accepts order requests and publishes event to an event router via a Lambda function<\/li>\n\n\n\n<li>The event router is built using AWS EventBridge event bus that matches incoming requests&#8217; location and routes them to target destinations for processing:\n<ul class=\"wp-block-list\">\n<li>Orders originating from the US will be routed to an API destination.<\/li>\n\n\n\n<li>Orders originating from Europe will be routed to a Step Functions workflow.<\/li>\n\n\n\n<li>All orders, regardless of their locations, will be routed to a Lambda Function to store the order details into a DynamoDB table and send back an order dispatch event to the event bus.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>By following this approach, we can create a robust and flexible order fulfillment system capable of handling various requirements and scaling efficiently.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"911\" height=\"661\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/EDA-8.png\" alt=\"\" class=\"wp-image-391\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/EDA-8.png 911w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/EDA-8-300x218.png 300w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/EDA-8-768x557.png 768w\" sizes=\"auto, (max-width: 911px) 100vw, 911px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Objectives<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create an Event Bus:\n<ul class=\"wp-block-list\">\n<li>Set up an AWS EventBridge event bus named <strong>Orders<\/strong>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Implement Event Rules:\n<ul class=\"wp-block-list\">\n<li>Create four event rules using AWS EventBridge:\n<ul class=\"wp-block-list\">\n<li><strong>OrdertoCloudWatch<\/strong><\/li>\n\n\n\n<li><strong>USOrdertoAPI<\/strong><\/li>\n\n\n\n<li><strong>EUOrdertoStepFunctions<\/strong><\/li>\n\n\n\n<li><strong>ProcessedOrderstoLambda<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Create Lambda Functions:\n<ul class=\"wp-block-list\">\n<li>Develop two Lambda functions:\n<ul class=\"wp-block-list\">\n<li><strong>ProduceOrder<\/strong> to publish events to the event bus.<\/li>\n\n\n\n<li><strong>ProcessedOrder<\/strong> to handle events from the event bus.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Develop REST APIs:\n<ul class=\"wp-block-list\">\n<li>Set up two REST APIs:\n<ul class=\"wp-block-list\">\n<li><strong>OrderProducer<\/strong> to accept order requests.<\/li>\n\n\n\n<li><strong>OrderConsumer<\/strong> to process order requests.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Implement a Workflow:\n<ul class=\"wp-block-list\">\n<li>Use AWS Step Functions to create a workflow for processing orders.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Create a DynamoDB Table:\n<ul class=\"wp-block-list\">\n<li>Set up a DynamoDB table named <strong>OrderDetails<\/strong> to store order information.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Establish IAM Policies:\n<ul class=\"wp-block-list\">\n<li>Create and configure IAM policies to grant necessary permissions to all services involved.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Create Event Bus and CloudWatch Event Rule<\/h2>\n\n\n\n<p>Go to <strong>EventBridge<\/strong> console, select <strong>Event buses<\/strong> and click <strong>Create event bus<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"757\" height=\"615\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image.png\" alt=\"\" class=\"wp-image-282\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image.png 757w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-300x244.png 300w\" sizes=\"auto, (max-width: 757px) 100vw, 757px\" \/><\/figure>\n\n\n\n<p>To easily test the event bus, I will create an event rule that act as a &#8216;catch-all&#8217; for every event that passes to the event bus and writes it to a CloudWatch log.<\/p>\n\n\n\n<p>Select the newly created <strong>Orders<\/strong> event bus and click <strong>Create rule<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"910\" height=\"668\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-3.png\" alt=\"\" class=\"wp-image-286\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-3.png 910w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-3-300x220.png 300w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-3-768x564.png 768w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"930\" height=\"642\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-4.png\" alt=\"\" class=\"wp-image-287\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-4.png 930w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-4-300x207.png 300w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-4-768x530.png 768w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/figure>\n\n\n\n<p>In the Event pattern, all events that come from source &#8220;<strong>com.aws.order<\/strong>&#8221; will be written to the CloudWatch log:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"784\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-6.png\" alt=\"\" class=\"wp-image-289\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-6.png 738w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-6-282x300.png 282w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/figure>\n\n\n\n<p>Select CloudWatch log group as the target for the event rule and name the log group suffix as \/aws\/events\/<strong>orders<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"674\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-8.png\" alt=\"\" class=\"wp-image-291\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-8.png 660w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-8-294x300.png 294w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/figure>\n\n\n\n<p>Now, every event sent to the Orders event bus will be logged to CloudWatch, making it easier to test and verify the events. To see the action, select <strong>Orders<\/strong> and click <strong>Send events<\/strong> with the following JSON payload:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">Event Source: com.aws.orders\nDetail Type: Order Notification\nEvent detail:\n{\n  \"category\": \"pencil\",\n  \"value\": 200,\n  \"location\": \"ca-central\"\n}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"741\" height=\"680\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-9.png\" alt=\"\" class=\"wp-image-292\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-9.png 741w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-9-300x275.png 300w\" sizes=\"auto, (max-width: 741px) 100vw, 741px\" \/><\/figure>\n\n\n\n<p>Open CloudWatch console, choose the log group \/aws\/events\/orders and select the last log stream to verify that the event has been received by the event bus.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"806\" height=\"754\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-10.png\" alt=\"\" class=\"wp-image-293\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-10.png 806w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-10-300x281.png 300w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-10-768x718.png 768w\" sizes=\"auto, (max-width: 806px) 100vw, 806px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"843\" height=\"507\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-11.png\" alt=\"\" class=\"wp-image-294\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-11.png 843w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-11-300x180.png 300w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-11-768x462.png 768w\" sizes=\"auto, (max-width: 843px) 100vw, 843px\" \/><\/figure>\n\n\n\n<p>By following these steps, you can confirm that your &#8216;catch-all&#8217; rule is working and that events are being properly logged to CloudWatch.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Create Producer REST API and Lambda Function<\/h2>\n\n\n\n<p>I will create a Lambda function as a event producer to publish new order request to the event bus. Go to <strong>Lambda Function<\/strong> console and select <strong>Create function<\/strong>. The function reads an order details (location, category, value) from its parameters and publish the details to the <strong>Orders<\/strong> event bus.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"734\" height=\"704\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-17.png\" alt=\"\" class=\"wp-image-302\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-17.png 734w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-17-300x288.png 300w\" sizes=\"auto, (max-width: 734px) 100vw, 734px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"885\" height=\"611\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-16.png\" alt=\"\" class=\"wp-image-301\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-16.png 885w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-16-300x207.png 300w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-16-768x530.png 768w\" sizes=\"auto, (max-width: 885px) 100vw, 885px\" \/><\/figure>\n\n\n\n<p>I will use API to simulate external parties making order requests and invoke my Lambda function to publish the order to the event bus. Go to API Gateway and click Create REST API.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"667\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-14.png\" alt=\"\" class=\"wp-image-299\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-14.png 744w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-14-300x269.png 300w\" sizes=\"auto, (max-width: 744px) 100vw, 744px\" \/><\/figure>\n\n\n\n<p>Select the <strong>ProduceOrder<\/strong> Lambda Function for integration.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"732\" height=\"801\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-15.png\" alt=\"\" class=\"wp-image-300\" style=\"width:739px;height:auto\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-15.png 732w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-15-274x300.png 274w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/figure>\n\n\n\n<p>Select <strong>Deploy API<\/strong> and create a new stage for deployment.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"878\" height=\"456\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-18.png\" alt=\"\" class=\"wp-image-303\" style=\"width:730px;height:auto\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-18.png 878w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-18-300x156.png 300w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-18-768x399.png 768w\" sizes=\"auto, (max-width: 878px) 100vw, 878px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"523\" height=\"505\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-19.png\" alt=\"\" class=\"wp-image-304\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-19.png 523w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-19-300x290.png 300w\" sizes=\"auto, (max-width: 523px) 100vw, 523px\" \/><\/figure>\n\n\n\n<p>After deploying the API, we can find the <strong>Invoke URL<\/strong> in <strong>Stages<\/strong>. To test the API, simply open the URL from the browser.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"892\" height=\"541\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/stage.png\" alt=\"\" class=\"wp-image-308\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/stage.png 892w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/stage-300x182.png 300w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/stage-768x466.png 768w\" sizes=\"auto, (max-width: 892px) 100vw, 892px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"225\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/browser.png\" alt=\"\" class=\"wp-image-307\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/browser.png 750w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/browser-300x90.png 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p>By following these steps, you can simulate external parties making order requests through the API, which will invoke the Lambda function to publish the order to the event bus.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Event Rule to Route Orders to API Gateway<\/h2>\n\n\n\n<p>EventBridge event rules use event patterns to select events and route them to targets. Events in AWS EventBridge are presented as JSON objects with following structure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n  \"version\": \"0\",\n  \"id\": \"6a7e8feb-b491-4cf7-a9f1-bf3703467718\",\n  \"detail-type\": \"Order Notification\",\n  \"source\": \"com.aws.orders\",\n  \"account\": \"111111111111\",\n  \"time\": \"2024-06-08T18:43:48Z\",\n  \"region\": \"ca-central-1\",\n  \"resources\": [],\n  \"detail\": {\n    \"category\": \"supplies\",\n    \"value\": 100,\n    \"location\": \"us-east\",\n  }\n}<\/code><\/pre>\n\n\n\n<p>I will create my first event rule to route orders with location matching &#8216;us-east&#8217; to an API destination. My event pattern looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n  \"source\": [\"com.aws.orders\"],\n  \"detail\": {\n    \"location\": [\"us-east\"]\n  }\n}<\/code><\/pre>\n\n\n\n<p>First I will setup the API destination by creating a dummy REST API. Go to API Gateway console and choose Create API.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"736\" height=\"664\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-24.png\" alt=\"\" class=\"wp-image-319\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-24.png 736w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-24-300x271.png 300w\" sizes=\"auto, (max-width: 736px) 100vw, 736px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"743\" height=\"588\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-26.png\" alt=\"\" class=\"wp-image-321\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-26.png 743w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-26-300x237.png 300w\" sizes=\"auto, (max-width: 743px) 100vw, 743px\" \/><\/figure>\n\n\n\n<p>Deploy the API to obtain the API destination endpoint (e.g., <em>https:\/\/&lt;app-id&gt;.execute-api.&lt;region&gt;.amazonaws.com\/dev<\/em>).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"523\" height=\"504\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-27.png\" alt=\"\" class=\"wp-image-322\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-27.png 523w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-27-300x289.png 300w\" sizes=\"auto, (max-width: 523px) 100vw, 523px\" \/><\/figure>\n\n\n\n<p>Now we create the event rule, select EventBridge <strong>Rules<\/strong> and click on Create rule<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"972\" height=\"665\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-21.png\" alt=\"\" class=\"wp-image-315\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-21.png 972w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-21-300x205.png 300w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-21-768x525.png 768w\" sizes=\"auto, (max-width: 972px) 100vw, 972px\" \/><\/figure>\n\n\n\n<p>Copy and paste the above event pattern and select Next.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"785\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-23.png\" alt=\"\" class=\"wp-image-318\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-23.png 688w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-23-263x300.png 263w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><\/figure>\n\n\n\n<p>To configure the event rule to route to an API destination, we need to create a new API destination. Under API destination, choose Create a new API destination with the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>API destination endpoint: <em><strong>&lt;https:\/\/&lt;app-id&gt;.execute-api.&lt;region&gt;.amazonaws.com\/dev&gt;<\/strong><\/em><\/li>\n\n\n\n<li>HTTP method: <strong>POST<\/strong><\/li>\n\n\n\n<li>Connection type: Create a new connection<\/li>\n\n\n\n<li>Authorization type: <strong>Basic (Username\/Password)<\/strong><\/li>\n\n\n\n<li>Username: <strong>myUsername<\/strong><\/li>\n\n\n\n<li>Password: <strong>myPassword<\/strong><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"701\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-32-1.png\" alt=\"\" class=\"wp-image-334\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-32-1.png 690w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-32-1-295x300.png 295w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"699\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-31.png\" alt=\"\" class=\"wp-image-326\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-31.png 690w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-31-296x300.png 296w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/figure>\n\n\n\n<p>To verify the event rule, I can simply call our Producer API with the following parameters:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">https:\/\/xxx.execute-api.ca-central-1.amazonaws.com\/dev?location=us-east&amp;category=office-supplies&amp;value=200<\/code><\/pre>\n\n\n\n<p>To see the log, open CloudWatch Log Group console and select the Log group <strong>API-Gateway-Execution-Logs<\/strong> prefix. The log event shows the API responds successfully with a 200 status.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"988\" height=\"261\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/image-33-1.png\" alt=\"\" class=\"wp-image-335\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-33-1.png 988w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-33-1-300x79.png 300w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/image-33-1-768x203.png 768w\" sizes=\"auto, (max-width: 988px) 100vw, 988px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"872\" height=\"78\" src=\"http:\/\/184.72.63.26\/wp-content\/uploads\/2024\/06\/cloudwatchlog.png\" alt=\"\" class=\"wp-image-356\" srcset=\"https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/cloudwatchlog.png 872w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/cloudwatchlog-300x27.png 300w, https:\/\/www.wallacel.com\/wp-content\/uploads\/2024\/06\/cloudwatchlog-768x69.png 768w\" sizes=\"auto, (max-width: 872px) 100vw, 872px\" \/><\/figure>\n\n\n\n<p>Now, any order event with the location set to us-east will be routed to the API Gateway endpoint. This setup ensures that orders from the specified region are correctly processed by the designated API. <\/p>\n\n\n\n<p>Thank you for reading my post. Stay tuned for Part 2, where I&#8217;ll cover the remaining implementation steps.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog post, I will walk through the journey to build a simple order fulfillment system using an Event-Driven Architecture (EDA). EDA is an architecture pattern designed to decouple and decentralize application components by allowing loosely couple services to communicate through asynchronously publishing and subscribing to events via an event router. EDA offers several [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":402,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[28,29],"class_list":["post-277","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws","tag-event-driven-architecture","tag-eventbridge"],"_links":{"self":[{"href":"https:\/\/www.wallacel.com\/index.php\/wp-json\/wp\/v2\/posts\/277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wallacel.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wallacel.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wallacel.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wallacel.com\/index.php\/wp-json\/wp\/v2\/comments?post=277"}],"version-history":[{"count":28,"href":"https:\/\/www.wallacel.com\/index.php\/wp-json\/wp\/v2\/posts\/277\/revisions"}],"predecessor-version":[{"id":494,"href":"https:\/\/www.wallacel.com\/index.php\/wp-json\/wp\/v2\/posts\/277\/revisions\/494"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wallacel.com\/index.php\/wp-json\/wp\/v2\/media\/402"}],"wp:attachment":[{"href":"https:\/\/www.wallacel.com\/index.php\/wp-json\/wp\/v2\/media?parent=277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wallacel.com\/index.php\/wp-json\/wp\/v2\/categories?post=277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wallacel.com\/index.php\/wp-json\/wp\/v2\/tags?post=277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}