[{"data":1,"prerenderedAt":77},["ShallowReactive",2],{"pattern-eventbridge-custom-lambda-sync-typescript-sam":3,"pattern-group-eventbridge-custom-lambda-sync-typescript-sam":76},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":10,"deploy":12,"description":16,"extension":17,"framework":18,"gitHub":19,"highlight":6,"introBox":23,"language":29,"level":30,"meta":31,"patternArch":32,"patternGroup":6,"patternGroupLabel":6,"resources":60,"stem":68,"testing":69,"videoId":6,"__hash__":75},"patterns\u002Fpatterns\u002Feventbridge-custom-lambda-sync-typescript-sam.json","Ordered processing with a synchronous AWS Lambda target on Amazon EventBridge",null,{"text":8},[9],"Delete the stack: \u003Ccode>sam delete\u003C\u002Fcode>",[11],"content\u002Fcontributors\u002Fkurt-tometich.json",{"text":13},[14,15],"sam build --template infra\u002Ftemplate.yaml","sam deploy --guided --capabilities CAPABILITY_NAMED_IAM","Processes events in order by invoking an AWS Lambda function synchronously from a FIFO subscriber on an Amazon EventBridge custom event bus.","json","AWS SAM",{"template":20},{"patternPath":21,"templateFile":22},"eventbridge-custom-lambda-sync\u002Ftypescript\u002Fsam","infra\u002Ftemplate.yaml",{"headline":24,"text":25},"How it works",[26,27,28],"This pattern shows how an Amazon EventBridge custom event bus (the eventsv2 API) processes events in order by invoking an AWS Lambda function synchronously (`InvocationType` `REQUEST_RESPONSE`) from a FIFO subscriber.","The publisher sends a sequence of `OrderPlaced` events that share one `EventGroupId`, each carrying a monotonically increasing sequence number. The FIFO subscriber invokes the consumer AWS Lambda function synchronously, waiting for each event to be confirmed before delivering the next in the group. The consumer logs each sequence number as it processes, and the Amazon CloudWatch log shows the sequence handled in order, one at a time. Synchronous confirmation gives the reliability and back-pressure that teams used to get by adding an Amazon SQS queue between the bus and AWS Lambda, so no Amazon SQS buffer sits in the path.","This deploys one Amazon EventBridge custom event bus, one FIFO subscriber configured for synchronous invocation, one Node.js 24 (TypeScript) AWS Lambda function, an Amazon SQS dead-letter queue (safety net), and the AWS Identity and Access Management (IAM) delivery role.","TypeScript","300",{},{"icon1":33,"icon2":38,"icon3":42,"icon4":47,"line1":51,"line2":55,"line3":57},{"x":34,"y":35,"service":36,"label":37},15,50,"eventbridge","Amazon EventBridge",{"x":39,"y":35,"service":40,"label":41},40,"lambda-event-functions","AWS Lambda",{"x":43,"y":44,"service":45,"label":46},80,30,"cloudwatch","Amazon CloudWatch",{"x":43,"y":48,"service":49,"label":50},70,"sqs","Amazon SQS DLQ",{"from":52,"to":53,"label":54},"icon1","icon2","FIFO, sync",{"from":53,"to":56},"icon3",{"from":53,"to":58,"label":59},"icon4","on failure",{"bullets":61},[62,65],{"text":63,"link":64},"Amazon EventBridge event buses","https:\u002F\u002Fdocs.aws.amazon.com\u002Feventbridge\u002Flatest\u002Fuserguide\u002Feb-event-bus.html",{"text":66,"link":67},"Invoking AWS Lambda functions with Amazon EventBridge","https:\u002F\u002Fdocs.aws.amazon.com\u002Feventbridge\u002Flatest\u002Fuserguide\u002Feb-targets.html","patterns\u002Feventbridge-custom-lambda-sync-typescript-sam",{"text":70},[71,72,73,74],"Run the offline unit tests: \u003Ccode>npm test\u003C\u002Fcode>","After deploying, publish an ordered sequence: \u003Ccode>scripts\u002Frun_publish.sh [stack-name] [region] [count]\u003C\u002Fcode>","Watch the consumer process the group in order: \u003Ccode>aws logs tail \u002Faws\u002Flambda\u002Fsync-orders-consumer --since 5m --format short\u003C\u002Fcode>","The 'Processing order ... seq=' lines appear in order (seq=1, then seq=2, then seq=3, ...), confirming ordered, synchronous delivery.","Nb9Agh35GANesK9LyaTzEmcCl3Qo59KANYTCEvhYR6A",[],1794310734489]